Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
chakrashim: Fixed v8 APIs after merge
Browse files Browse the repository at this point in the history
Added 'HeapSpaceStatistics' API from v8 into chakrashim.
  • Loading branch information
kunalspathak committed Jan 22, 2016
1 parent c4dee62 commit c4f1afc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
22 changes: 22 additions & 0 deletions deps/chakrashim/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -2064,6 +2064,25 @@ class V8_EXPORT HeapStatistics {
size_t heap_size_limit() { return 0; }
};

class V8_EXPORT HeapSpaceStatistics {
public:
HeapSpaceStatistics() {}
const char* space_name() { return ""; }
size_t space_size() { return 0; }
size_t space_used_size() { return 0; }
size_t space_available_size() { return 0; }
size_t physical_space_size() { return 0; }

private:
const char* space_name_;
size_t space_size_;
size_t space_used_size_;
size_t space_available_size_;
size_t physical_space_size_;

friend class Isolate;
};

typedef void(*FunctionEntryHook)(uintptr_t function,
uintptr_t return_addr_location);
typedef int* (*CounterLookupCallback)(const char* name);
Expand Down Expand Up @@ -2116,6 +2135,9 @@ class V8_EXPORT Isolate {
void Dispose();

void GetHeapStatistics(HeapStatistics *heap_statistics);
size_t NumberOfHeapSpaces();
bool GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics,
size_t index);
int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
void SetData(uint32_t slot, void* data);
void* GetData(uint32_t slot);
Expand Down
4 changes: 2 additions & 2 deletions deps/chakrashim/lib/chakra_shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
});

return ensureStackTrace;
};
}

function patchErrorStack() {
Error.captureStackTrace = captureStackTrace;
Expand Down Expand Up @@ -315,7 +315,7 @@
function compareType(o, expectedType) {
return Object_prototype_toString.call(o) === '[object ' +
expectedType + ']';
};
}
utils.isBooleanObject = function(obj) {
return compareType(obj, 'Boolean');
};
Expand Down
11 changes: 11 additions & 0 deletions deps/chakrashim/src/v8isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,15 @@ void Isolate::GetHeapStatistics(HeapStatistics *heap_statistics) {
heap_statistics->set_heap_size(memoryUsage);
}

size_t Isolate::NumberOfHeapSpaces() {
//Chakra doesn't expose HEAP space stats
return 0;
}

bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics,
size_t index) {
//Chakra doesn't expose HEAP space stats
return true;
}

} // namespace v8

0 comments on commit c4f1afc

Please sign in to comment.