Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(949)

Side by Side Diff: src/api.cc

Issue 1312413002: Move runtime helper for JSSet and JSMap onto objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 6135 matching lines...) Expand 10 before | Expand all | Expand 10 after
6146 i::Handle<i::JSMap> obj = Utils::OpenHandle(this); 6146 i::Handle<i::JSMap> obj = Utils::OpenHandle(this);
6147 return i::OrderedHashMap::cast(obj->table())->NumberOfElements(); 6147 return i::OrderedHashMap::cast(obj->table())->NumberOfElements();
6148 } 6148 }
6149 6149
6150 6150
6151 void Map::Clear() { 6151 void Map::Clear() {
6152 auto self = Utils::OpenHandle(this); 6152 auto self = Utils::OpenHandle(this);
6153 i::Isolate* isolate = self->GetIsolate(); 6153 i::Isolate* isolate = self->GetIsolate();
6154 LOG_API(isolate, "Map::Clear"); 6154 LOG_API(isolate, "Map::Clear");
6155 ENTER_V8(isolate); 6155 ENTER_V8(isolate);
6156 i::Runtime::JSMapClear(isolate, self); 6156 i::JSMap::Clear(self);
6157 } 6157 }
6158 6158
6159 6159
6160 MaybeLocal<Value> Map::Get(Local<Context> context, Local<Value> key) { 6160 MaybeLocal<Value> Map::Get(Local<Context> context, Local<Value> key) {
6161 PREPARE_FOR_EXECUTION(context, "Map::Get", Value); 6161 PREPARE_FOR_EXECUTION(context, "Map::Get", Value);
6162 auto self = Utils::OpenHandle(this); 6162 auto self = Utils::OpenHandle(this);
6163 Local<Value> result; 6163 Local<Value> result;
6164 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; 6164 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)};
6165 has_pending_exception = 6165 has_pending_exception =
6166 !ToLocal<Value>(i::Execution::Call(isolate, isolate->map_get(), self, 6166 !ToLocal<Value>(i::Execution::Call(isolate, isolate->map_get(), self,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
6262 i::Handle<i::JSSet> obj = Utils::OpenHandle(this); 6262 i::Handle<i::JSSet> obj = Utils::OpenHandle(this);
6263 return i::OrderedHashSet::cast(obj->table())->NumberOfElements(); 6263 return i::OrderedHashSet::cast(obj->table())->NumberOfElements();
6264 } 6264 }
6265 6265
6266 6266
6267 void Set::Clear() { 6267 void Set::Clear() {
6268 auto self = Utils::OpenHandle(this); 6268 auto self = Utils::OpenHandle(this);
6269 i::Isolate* isolate = self->GetIsolate(); 6269 i::Isolate* isolate = self->GetIsolate();
6270 LOG_API(isolate, "Set::Clear"); 6270 LOG_API(isolate, "Set::Clear");
6271 ENTER_V8(isolate); 6271 ENTER_V8(isolate);
6272 i::Runtime::JSSetClear(isolate, self); 6272 i::JSSet::Clear(self);
6273 } 6273 }
6274 6274
6275 6275
6276 MaybeLocal<Set> Set::Add(Local<Context> context, Local<Value> key) { 6276 MaybeLocal<Set> Set::Add(Local<Context> context, Local<Value> key) {
6277 PREPARE_FOR_EXECUTION(context, "Set::Add", Set); 6277 PREPARE_FOR_EXECUTION(context, "Set::Add", Set);
6278 auto self = Utils::OpenHandle(this); 6278 auto self = Utils::OpenHandle(this);
6279 i::Handle<i::Object> result; 6279 i::Handle<i::Object> result;
6280 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; 6280 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)};
6281 has_pending_exception = 6281 has_pending_exception =
6282 !i::Execution::Call(isolate, isolate->set_add(), self, arraysize(argv), 6282 !i::Execution::Call(isolate, isolate->set_add(), self, arraysize(argv),
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
6528 void v8::ArrayBuffer::Neuter() { 6528 void v8::ArrayBuffer::Neuter() {
6529 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); 6529 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this);
6530 i::Isolate* isolate = obj->GetIsolate(); 6530 i::Isolate* isolate = obj->GetIsolate();
6531 Utils::ApiCheck(obj->is_external(), 6531 Utils::ApiCheck(obj->is_external(),
6532 "v8::ArrayBuffer::Neuter", 6532 "v8::ArrayBuffer::Neuter",
6533 "Only externalized ArrayBuffers can be neutered"); 6533 "Only externalized ArrayBuffers can be neutered");
6534 Utils::ApiCheck(obj->is_neuterable(), "v8::ArrayBuffer::Neuter", 6534 Utils::ApiCheck(obj->is_neuterable(), "v8::ArrayBuffer::Neuter",
6535 "Only neuterable ArrayBuffers can be neutered"); 6535 "Only neuterable ArrayBuffers can be neutered");
6536 LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()"); 6536 LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()");
6537 ENTER_V8(isolate); 6537 ENTER_V8(isolate);
6538 i::Runtime::NeuterArrayBuffer(obj); 6538 obj->Neuter();
6539 } 6539 }
6540 6540
6541 6541
6542 size_t v8::ArrayBuffer::ByteLength() const { 6542 size_t v8::ArrayBuffer::ByteLength() const {
6543 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); 6543 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this);
6544 return static_cast<size_t>(obj->byte_length()->Number()); 6544 return static_cast<size_t>(obj->byte_length()->Number());
6545 } 6545 }
6546 6546
6547 6547
6548 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) { 6548 Local<ArrayBuffer> v8::ArrayBuffer::New(Isolate* isolate, size_t byte_length) {
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
8408 Address callback_address = 8408 Address callback_address =
8409 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8409 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8410 VMState<EXTERNAL> state(isolate); 8410 VMState<EXTERNAL> state(isolate);
8411 ExternalCallbackScope call_scope(isolate, callback_address); 8411 ExternalCallbackScope call_scope(isolate, callback_address);
8412 callback(info); 8412 callback(info);
8413 } 8413 }
8414 8414
8415 8415
8416 } // namespace internal 8416 } // namespace internal
8417 } // namespace v8 8417 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698