Move runtime helper for JSSet and JSMap onto objects.
R=rossberg@chromium.org Review URL: https://codereview.chromium.org/1312413002 Cr-Commit-Position: refs/heads/master@{#30384}
This commit is contained in:
parent
ba968622ac
commit
68dfaf78d8
@ -6153,7 +6153,7 @@ void Map::Clear() {
|
|||||||
i::Isolate* isolate = self->GetIsolate();
|
i::Isolate* isolate = self->GetIsolate();
|
||||||
LOG_API(isolate, "Map::Clear");
|
LOG_API(isolate, "Map::Clear");
|
||||||
ENTER_V8(isolate);
|
ENTER_V8(isolate);
|
||||||
i::Runtime::JSMapClear(isolate, self);
|
i::JSMap::Clear(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6269,7 +6269,7 @@ void Set::Clear() {
|
|||||||
i::Isolate* isolate = self->GetIsolate();
|
i::Isolate* isolate = self->GetIsolate();
|
||||||
LOG_API(isolate, "Set::Clear");
|
LOG_API(isolate, "Set::Clear");
|
||||||
ENTER_V8(isolate);
|
ENTER_V8(isolate);
|
||||||
i::Runtime::JSSetClear(isolate, self);
|
i::JSSet::Clear(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6535,7 +6535,7 @@ void v8::ArrayBuffer::Neuter() {
|
|||||||
"Only neuterable ArrayBuffers can be neutered");
|
"Only neuterable ArrayBuffers can be neutered");
|
||||||
LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()");
|
LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()");
|
||||||
ENTER_V8(isolate);
|
ENTER_V8(isolate);
|
||||||
i::Runtime::NeuterArrayBuffer(obj);
|
obj->Neuter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1633,7 +1633,7 @@ Handle<JSDataView> Factory::NewJSDataView() {
|
|||||||
Handle<JSMap> Factory::NewJSMap() {
|
Handle<JSMap> Factory::NewJSMap() {
|
||||||
Handle<Map> map(isolate()->native_context()->js_map_map());
|
Handle<Map> map(isolate()->native_context()->js_map_map());
|
||||||
Handle<JSMap> js_map = Handle<JSMap>::cast(NewJSObjectFromMap(map));
|
Handle<JSMap> js_map = Handle<JSMap>::cast(NewJSObjectFromMap(map));
|
||||||
Runtime::JSMapInitialize(isolate(), js_map);
|
JSMap::Initialize(js_map, isolate());
|
||||||
return js_map;
|
return js_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1641,7 +1641,7 @@ Handle<JSMap> Factory::NewJSMap() {
|
|||||||
Handle<JSSet> Factory::NewJSSet() {
|
Handle<JSSet> Factory::NewJSSet() {
|
||||||
Handle<Map> map(isolate()->native_context()->js_set_map());
|
Handle<Map> map(isolate()->native_context()->js_set_map());
|
||||||
Handle<JSSet> js_set = Handle<JSSet>::cast(NewJSObjectFromMap(map));
|
Handle<JSSet> js_set = Handle<JSSet>::cast(NewJSObjectFromMap(map));
|
||||||
Runtime::JSSetInitialize(isolate(), js_set);
|
JSSet::Initialize(js_set, isolate());
|
||||||
return js_set;
|
return js_set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15127,6 +15127,32 @@ template void
|
|||||||
OrderedHashTableIterator<JSMapIterator, OrderedHashMap>::Transition();
|
OrderedHashTableIterator<JSMapIterator, OrderedHashMap>::Transition();
|
||||||
|
|
||||||
|
|
||||||
|
void JSSet::Initialize(Handle<JSSet> set, Isolate* isolate) {
|
||||||
|
Handle<OrderedHashSet> table = isolate->factory()->NewOrderedHashSet();
|
||||||
|
set->set_table(*table);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void JSSet::Clear(Handle<JSSet> set) {
|
||||||
|
Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table()));
|
||||||
|
table = OrderedHashSet::Clear(table);
|
||||||
|
set->set_table(*table);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void JSMap::Initialize(Handle<JSMap> map, Isolate* isolate) {
|
||||||
|
Handle<OrderedHashMap> table = isolate->factory()->NewOrderedHashMap();
|
||||||
|
map->set_table(*table);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void JSMap::Clear(Handle<JSMap> map) {
|
||||||
|
Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table()));
|
||||||
|
table = OrderedHashMap::Clear(table);
|
||||||
|
map->set_table(*table);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check if there is a break point at this code position.
|
// Check if there is a break point at this code position.
|
||||||
bool DebugInfo::HasBreakPoint(int code_position) {
|
bool DebugInfo::HasBreakPoint(int code_position) {
|
||||||
// Get the break point info object for this code position.
|
// Get the break point info object for this code position.
|
||||||
|
@ -9301,6 +9301,9 @@ class JSSet : public JSCollection {
|
|||||||
public:
|
public:
|
||||||
DECLARE_CAST(JSSet)
|
DECLARE_CAST(JSSet)
|
||||||
|
|
||||||
|
static void Initialize(Handle<JSSet> set, Isolate* isolate);
|
||||||
|
static void Clear(Handle<JSSet> set);
|
||||||
|
|
||||||
// Dispatched behavior.
|
// Dispatched behavior.
|
||||||
DECLARE_PRINTER(JSSet)
|
DECLARE_PRINTER(JSSet)
|
||||||
DECLARE_VERIFIER(JSSet)
|
DECLARE_VERIFIER(JSSet)
|
||||||
@ -9315,6 +9318,9 @@ class JSMap : public JSCollection {
|
|||||||
public:
|
public:
|
||||||
DECLARE_CAST(JSMap)
|
DECLARE_CAST(JSMap)
|
||||||
|
|
||||||
|
static void Initialize(Handle<JSMap> map, Isolate* isolate);
|
||||||
|
static void Clear(Handle<JSMap> map);
|
||||||
|
|
||||||
// Dispatched behavior.
|
// Dispatched behavior.
|
||||||
DECLARE_PRINTER(JSMap)
|
DECLARE_PRINTER(JSMap)
|
||||||
DECLARE_VERIFIER(JSMap)
|
DECLARE_VERIFIER(JSMap)
|
||||||
|
@ -45,17 +45,11 @@ RUNTIME_FUNCTION(Runtime_GenericHash) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Runtime::JSSetInitialize(Isolate* isolate, Handle<JSSet> set) {
|
|
||||||
Handle<OrderedHashSet> table = isolate->factory()->NewOrderedHashSet();
|
|
||||||
set->set_table(*table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RUNTIME_FUNCTION(Runtime_SetInitialize) {
|
RUNTIME_FUNCTION(Runtime_SetInitialize) {
|
||||||
HandleScope scope(isolate);
|
HandleScope scope(isolate);
|
||||||
DCHECK(args.length() == 1);
|
DCHECK(args.length() == 1);
|
||||||
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
|
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
|
||||||
Runtime::JSSetInitialize(isolate, holder);
|
JSSet::Initialize(holder, isolate);
|
||||||
return *holder;
|
return *holder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,18 +76,11 @@ RUNTIME_FUNCTION(Runtime_SetShrink) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Runtime::JSSetClear(Isolate* isolate, Handle<JSSet> set) {
|
|
||||||
Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table()));
|
|
||||||
table = OrderedHashSet::Clear(table);
|
|
||||||
set->set_table(*table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RUNTIME_FUNCTION(Runtime_SetClear) {
|
RUNTIME_FUNCTION(Runtime_SetClear) {
|
||||||
HandleScope scope(isolate);
|
HandleScope scope(isolate);
|
||||||
DCHECK(args.length() == 1);
|
DCHECK(args.length() == 1);
|
||||||
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
|
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
|
||||||
Runtime::JSSetClear(isolate, holder);
|
JSSet::Clear(holder);
|
||||||
return isolate->heap()->undefined_value();
|
return isolate->heap()->undefined_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,17 +140,11 @@ RUNTIME_FUNCTION(Runtime_SetIteratorDetails) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Runtime::JSMapInitialize(Isolate* isolate, Handle<JSMap> map) {
|
|
||||||
Handle<OrderedHashMap> table = isolate->factory()->NewOrderedHashMap();
|
|
||||||
map->set_table(*table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RUNTIME_FUNCTION(Runtime_MapInitialize) {
|
RUNTIME_FUNCTION(Runtime_MapInitialize) {
|
||||||
HandleScope scope(isolate);
|
HandleScope scope(isolate);
|
||||||
DCHECK(args.length() == 1);
|
DCHECK(args.length() == 1);
|
||||||
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
|
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
|
||||||
Runtime::JSMapInitialize(isolate, holder);
|
JSMap::Initialize(holder, isolate);
|
||||||
return *holder;
|
return *holder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,18 +160,11 @@ RUNTIME_FUNCTION(Runtime_MapShrink) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Runtime::JSMapClear(Isolate* isolate, Handle<JSMap> map) {
|
|
||||||
Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table()));
|
|
||||||
table = OrderedHashMap::Clear(table);
|
|
||||||
map->set_table(*table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RUNTIME_FUNCTION(Runtime_MapClear) {
|
RUNTIME_FUNCTION(Runtime_MapClear) {
|
||||||
HandleScope scope(isolate);
|
HandleScope scope(isolate);
|
||||||
DCHECK(args.length() == 1);
|
DCHECK(args.length() == 1);
|
||||||
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
|
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
|
||||||
Runtime::JSMapClear(isolate, holder);
|
JSMap::Clear(holder);
|
||||||
return isolate->heap()->undefined_value();
|
return isolate->heap()->undefined_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,11 +67,6 @@ bool Runtime::SetupArrayBufferAllocatingData(Isolate* isolate,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Runtime::NeuterArrayBuffer(Handle<JSArrayBuffer> array_buffer) {
|
|
||||||
array_buffer->Neuter();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RUNTIME_FUNCTION(Runtime_ArrayBufferInitialize) {
|
RUNTIME_FUNCTION(Runtime_ArrayBufferInitialize) {
|
||||||
HandleScope scope(isolate);
|
HandleScope scope(isolate);
|
||||||
DCHECK(args.length() == 3);
|
DCHECK(args.length() == 3);
|
||||||
@ -150,7 +145,7 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferNeuter) {
|
|||||||
void* backing_store = array_buffer->backing_store();
|
void* backing_store = array_buffer->backing_store();
|
||||||
size_t byte_length = NumberToSize(isolate, array_buffer->byte_length());
|
size_t byte_length = NumberToSize(isolate, array_buffer->byte_length());
|
||||||
array_buffer->set_is_external(true);
|
array_buffer->set_is_external(true);
|
||||||
Runtime::NeuterArrayBuffer(array_buffer);
|
array_buffer->Neuter();
|
||||||
isolate->heap()->UnregisterArrayBuffer(
|
isolate->heap()->UnregisterArrayBuffer(
|
||||||
isolate->heap()->InNewSpace(*array_buffer), backing_store);
|
isolate->heap()->InNewSpace(*array_buffer), backing_store);
|
||||||
isolate->array_buffer_allocator()->Free(backing_store, byte_length);
|
isolate->array_buffer_allocator()->Free(backing_store, byte_length);
|
||||||
|
@ -1167,8 +1167,6 @@ class Runtime : public AllStatic {
|
|||||||
size_t allocated_length, bool initialize = true,
|
size_t allocated_length, bool initialize = true,
|
||||||
SharedFlag shared = SharedFlag::kNotShared);
|
SharedFlag shared = SharedFlag::kNotShared);
|
||||||
|
|
||||||
static void NeuterArrayBuffer(Handle<JSArrayBuffer> array_buffer);
|
|
||||||
|
|
||||||
enum TypedArrayId {
|
enum TypedArrayId {
|
||||||
// arrayIds below should be synchromized with typedarray.js natives.
|
// arrayIds below should be synchromized with typedarray.js natives.
|
||||||
ARRAY_ID_UINT8 = 1,
|
ARRAY_ID_UINT8 = 1,
|
||||||
@ -1193,12 +1191,6 @@ class Runtime : public AllStatic {
|
|||||||
Isolate* isolate, Handle<FixedArray> literals,
|
Isolate* isolate, Handle<FixedArray> literals,
|
||||||
Handle<FixedArray> elements, bool is_strong);
|
Handle<FixedArray> elements, bool is_strong);
|
||||||
|
|
||||||
|
|
||||||
static void JSMapInitialize(Isolate* isolate, Handle<JSMap> map);
|
|
||||||
static void JSMapClear(Isolate* isolate, Handle<JSMap> map);
|
|
||||||
static void JSSetInitialize(Isolate* isolate, Handle<JSSet> set);
|
|
||||||
static void JSSetClear(Isolate* isolate, Handle<JSSet> set);
|
|
||||||
|
|
||||||
static void WeakCollectionInitialize(
|
static void WeakCollectionInitialize(
|
||||||
Isolate* isolate, Handle<JSWeakCollection> weak_collection);
|
Isolate* isolate, Handle<JSWeakCollection> weak_collection);
|
||||||
static void WeakCollectionSet(Handle<JSWeakCollection> weak_collection,
|
static void WeakCollectionSet(Handle<JSWeakCollection> weak_collection,
|
||||||
|
Loading…
Reference in New Issue
Block a user