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

Side by Side Diff: src/api.cc

Issue 1942233002: [API] remove (deprecated) hidden properties. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | « include/v8.h ('k') | src/heap-symbols.h » ('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 4339 matching lines...) Expand 10 before | Expand all | Expand 10 after
4350 4350
4351 4351
4352 int v8::Object::GetIdentityHash() { 4352 int v8::Object::GetIdentityHash() {
4353 auto isolate = Utils::OpenHandle(this)->GetIsolate(); 4353 auto isolate = Utils::OpenHandle(this)->GetIsolate();
4354 i::HandleScope scope(isolate); 4354 i::HandleScope scope(isolate);
4355 auto self = Utils::OpenHandle(this); 4355 auto self = Utils::OpenHandle(this);
4356 return i::JSReceiver::GetOrCreateIdentityHash(self)->value(); 4356 return i::JSReceiver::GetOrCreateIdentityHash(self)->value();
4357 } 4357 }
4358 4358
4359 4359
4360 bool v8::Object::SetHiddenValue(v8::Local<v8::String> key,
4361 v8::Local<v8::Value> value) {
4362 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4363 ENTER_V8(isolate);
4364 i::HandleScope scope(isolate);
4365 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
4366 if (!self->IsJSObject()) return false;
4367 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
4368 i::Handle<i::String> key_string =
4369 isolate->factory()->InternalizeString(key_obj);
4370 if (value.IsEmpty()) {
4371 i::JSObject::DeleteHiddenProperty(i::Handle<i::JSObject>::cast(self),
4372 key_string);
4373 return true;
4374 }
4375 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
4376 i::Handle<i::Object> result = i::JSObject::SetHiddenProperty(
4377 i::Handle<i::JSObject>::cast(self), key_string, value_obj);
4378 return *result == *self;
4379 }
4380
4381
4382 v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Local<v8::String> key) {
4383 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4384 ENTER_V8(isolate);
4385 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
4386 if (!self->IsJSObject()) return v8::Local<v8::Value>();
4387 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
4388 i::Handle<i::String> key_string =
4389 isolate->factory()->InternalizeString(key_obj);
4390 i::Handle<i::Object> result(
4391 i::Handle<i::JSObject>::cast(self)->GetHiddenProperty(key_string),
4392 isolate);
4393 if (result->IsTheHole()) return v8::Local<v8::Value>();
4394 return Utils::ToLocal(result);
4395 }
4396
4397
4398 bool v8::Object::DeleteHiddenValue(v8::Local<v8::String> key) {
4399 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4400 ENTER_V8(isolate);
4401 i::HandleScope scope(isolate);
4402 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
4403 if (!self->IsJSObject()) return false;
4404 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
4405 i::Handle<i::String> key_string =
4406 isolate->factory()->InternalizeString(key_obj);
4407 i::JSObject::DeleteHiddenProperty(i::Handle<i::JSObject>::cast(self),
4408 key_string);
4409 return true;
4410 }
4411
4412
4413 bool v8::Object::IsCallable() { 4360 bool v8::Object::IsCallable() {
4414 auto self = Utils::OpenHandle(this); 4361 auto self = Utils::OpenHandle(this);
4415 return self->IsCallable(); 4362 return self->IsCallable();
4416 } 4363 }
4417 4364
4418 4365
4419 MaybeLocal<Value> Object::CallAsFunction(Local<Context> context, 4366 MaybeLocal<Value> Object::CallAsFunction(Local<Context> context,
4420 Local<Value> recv, int argc, 4367 Local<Value> recv, int argc,
4421 Local<Value> argv[]) { 4368 Local<Value> argv[]) {
4422 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Object::CallAsFunction()", 4369 PREPARE_FOR_EXECUTION_WITH_CALLBACK(context, "v8::Object::CallAsFunction()",
(...skipping 4426 matching lines...) Expand 10 before | Expand all | Expand 10 after
8849 Address callback_address = 8796 Address callback_address =
8850 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8797 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8851 VMState<EXTERNAL> state(isolate); 8798 VMState<EXTERNAL> state(isolate);
8852 ExternalCallbackScope call_scope(isolate, callback_address); 8799 ExternalCallbackScope call_scope(isolate, callback_address);
8853 callback(info); 8800 callback(info);
8854 } 8801 }
8855 8802
8856 8803
8857 } // namespace internal 8804 } // namespace internal
8858 } // namespace v8 8805 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/heap-symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698