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

Side by Side Diff: src/api.cc

Issue 1767123002: [runtime] Pass in receiver as target to the LookupIterator if known to be JSReceiver (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: property-descriptor Created 4 years, 9 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/builtins.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 3482 matching lines...) Expand 10 before | Expand all | Expand 10 after
3493 Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context, 3493 Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context,
3494 v8::Local<Name> key, 3494 v8::Local<Name> key,
3495 v8::Local<Value> value) { 3495 v8::Local<Value> value) {
3496 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::CreateDataProperty()", 3496 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::CreateDataProperty()",
3497 bool); 3497 bool);
3498 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this); 3498 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
3499 i::Handle<i::Name> key_obj = Utils::OpenHandle(*key); 3499 i::Handle<i::Name> key_obj = Utils::OpenHandle(*key);
3500 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 3500 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3501 3501
3502 i::LookupIterator it = i::LookupIterator::PropertyOrElement( 3502 i::LookupIterator it = i::LookupIterator::PropertyOrElement(
3503 isolate, self, key_obj, i::LookupIterator::OWN); 3503 isolate, self, key_obj, self, i::LookupIterator::OWN);
3504 Maybe<bool> result = 3504 Maybe<bool> result =
3505 i::JSReceiver::CreateDataProperty(&it, value_obj, i::Object::DONT_THROW); 3505 i::JSReceiver::CreateDataProperty(&it, value_obj, i::Object::DONT_THROW);
3506 has_pending_exception = result.IsNothing(); 3506 has_pending_exception = result.IsNothing();
3507 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 3507 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
3508 return result; 3508 return result;
3509 } 3509 }
3510 3510
3511 3511
3512 Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context, 3512 Maybe<bool> v8::Object::CreateDataProperty(v8::Local<v8::Context> context,
3513 uint32_t index, 3513 uint32_t index,
3514 v8::Local<Value> value) { 3514 v8::Local<Value> value) {
3515 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::CreateDataProperty()", 3515 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::CreateDataProperty()",
3516 bool); 3516 bool);
3517 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this); 3517 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
3518 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 3518 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3519 3519
3520 i::LookupIterator it(isolate, self, index, i::LookupIterator::OWN); 3520 i::LookupIterator it(isolate, self, index, self, i::LookupIterator::OWN);
3521 Maybe<bool> result = 3521 Maybe<bool> result =
3522 i::JSReceiver::CreateDataProperty(&it, value_obj, i::Object::DONT_THROW); 3522 i::JSReceiver::CreateDataProperty(&it, value_obj, i::Object::DONT_THROW);
3523 has_pending_exception = result.IsNothing(); 3523 has_pending_exception = result.IsNothing();
3524 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 3524 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
3525 return result; 3525 return result;
3526 } 3526 }
3527 3527
3528 3528
3529 Maybe<bool> v8::Object::DefineOwnProperty(v8::Local<v8::Context> context, 3529 Maybe<bool> v8::Object::DefineOwnProperty(v8::Local<v8::Context> context,
3530 v8::Local<Name> key, 3530 v8::Local<Name> key,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3616 i::PropertyDescriptor desc; 3616 i::PropertyDescriptor desc;
3617 desc.set_writable(true); 3617 desc.set_writable(true);
3618 desc.set_enumerable(false); 3618 desc.set_enumerable(false);
3619 desc.set_configurable(true); 3619 desc.set_configurable(true);
3620 desc.set_value(value_obj); 3620 desc.set_value(value_obj);
3621 return i::JSProxy::SetPrivateProperty( 3621 return i::JSProxy::SetPrivateProperty(
3622 isolate, i::Handle<i::JSProxy>::cast(self), 3622 isolate, i::Handle<i::JSProxy>::cast(self),
3623 i::Handle<i::Symbol>::cast(key_obj), &desc, i::Object::DONT_THROW); 3623 i::Handle<i::Symbol>::cast(key_obj), &desc, i::Object::DONT_THROW);
3624 } 3624 }
3625 auto js_object = i::Handle<i::JSObject>::cast(self); 3625 auto js_object = i::Handle<i::JSObject>::cast(self);
3626 i::LookupIterator it(js_object, key_obj); 3626 i::LookupIterator it(js_object, key_obj, js_object);
3627 has_pending_exception = i::JSObject::DefineOwnPropertyIgnoreAttributes( 3627 has_pending_exception = i::JSObject::DefineOwnPropertyIgnoreAttributes(
3628 &it, value_obj, i::DONT_ENUM) 3628 &it, value_obj, i::DONT_ENUM)
3629 .is_null(); 3629 .is_null();
3630 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 3630 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
3631 return Just(true); 3631 return Just(true);
3632 } 3632 }
3633 3633
3634 3634
3635 MaybeLocal<Value> v8::Object::Get(Local<v8::Context> context, 3635 MaybeLocal<Value> v8::Object::Get(Local<v8::Context> context,
3636 Local<Value> key) { 3636 Local<Value> key) {
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
4165 return GetRealNamedPropertyAttributesInPrototypeChain(context, key); 4165 return GetRealNamedPropertyAttributesInPrototypeChain(context, key);
4166 } 4166 }
4167 4167
4168 4168
4169 MaybeLocal<Value> v8::Object::GetRealNamedProperty(Local<Context> context, 4169 MaybeLocal<Value> v8::Object::GetRealNamedProperty(Local<Context> context,
4170 Local<Name> key) { 4170 Local<Name> key) {
4171 PREPARE_FOR_EXECUTION(context, "v8::Object::GetRealNamedProperty()", Value); 4171 PREPARE_FOR_EXECUTION(context, "v8::Object::GetRealNamedProperty()", Value);
4172 auto self = Utils::OpenHandle(this); 4172 auto self = Utils::OpenHandle(this);
4173 auto key_obj = Utils::OpenHandle(*key); 4173 auto key_obj = Utils::OpenHandle(*key);
4174 i::LookupIterator it = i::LookupIterator::PropertyOrElement( 4174 i::LookupIterator it = i::LookupIterator::PropertyOrElement(
4175 isolate, self, key_obj, 4175 isolate, self, key_obj, self,
4176 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); 4176 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
4177 Local<Value> result; 4177 Local<Value> result;
4178 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result); 4178 has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result);
4179 RETURN_ON_FAILED_EXECUTION(Value); 4179 RETURN_ON_FAILED_EXECUTION(Value);
4180 if (!it.IsFound()) return MaybeLocal<Value>(); 4180 if (!it.IsFound()) return MaybeLocal<Value>();
4181 RETURN_ESCAPED(result); 4181 RETURN_ESCAPED(result);
4182 } 4182 }
4183 4183
4184 4184
4185 Local<Value> v8::Object::GetRealNamedProperty(Local<String> key) { 4185 Local<Value> v8::Object::GetRealNamedProperty(Local<String> key) {
4186 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 4186 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
4187 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedProperty(context, key), Value); 4187 RETURN_TO_LOCAL_UNCHECKED(GetRealNamedProperty(context, key), Value);
4188 } 4188 }
4189 4189
4190 4190
4191 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes( 4191 Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes(
4192 Local<Context> context, Local<Name> key) { 4192 Local<Context> context, Local<Name> key) {
4193 PREPARE_FOR_EXECUTION_PRIMITIVE( 4193 PREPARE_FOR_EXECUTION_PRIMITIVE(
4194 context, "v8::Object::GetRealNamedPropertyAttributes()", 4194 context, "v8::Object::GetRealNamedPropertyAttributes()",
4195 PropertyAttribute); 4195 PropertyAttribute);
4196 auto self = Utils::OpenHandle(this); 4196 auto self = Utils::OpenHandle(this);
4197 auto key_obj = Utils::OpenHandle(*key); 4197 auto key_obj = Utils::OpenHandle(*key);
4198 i::LookupIterator it = i::LookupIterator::PropertyOrElement( 4198 i::LookupIterator it = i::LookupIterator::PropertyOrElement(
4199 isolate, self, key_obj, 4199 isolate, self, key_obj, self,
4200 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); 4200 i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
4201 auto result = i::JSReceiver::GetPropertyAttributes(&it); 4201 auto result = i::JSReceiver::GetPropertyAttributes(&it);
4202 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute); 4202 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute);
4203 if (!it.IsFound()) return Nothing<PropertyAttribute>(); 4203 if (!it.IsFound()) return Nothing<PropertyAttribute>();
4204 if (result.FromJust() == i::ABSENT) { 4204 if (result.FromJust() == i::ABSENT) {
4205 return Just(static_cast<PropertyAttribute>(i::NONE)); 4205 return Just(static_cast<PropertyAttribute>(i::NONE));
4206 } 4206 }
4207 return Just<PropertyAttribute>( 4207 return Just<PropertyAttribute>(
4208 static_cast<PropertyAttribute>(result.FromJust())); 4208 static_cast<PropertyAttribute>(result.FromJust()));
4209 } 4209 }
(...skipping 4484 matching lines...) Expand 10 before | Expand all | Expand 10 after
8694 Address callback_address = 8694 Address callback_address =
8695 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8695 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8696 VMState<EXTERNAL> state(isolate); 8696 VMState<EXTERNAL> state(isolate);
8697 ExternalCallbackScope call_scope(isolate, callback_address); 8697 ExternalCallbackScope call_scope(isolate, callback_address);
8698 callback(info); 8698 callback(info);
8699 } 8699 }
8700 8700
8701 8701
8702 } // namespace internal 8702 } // namespace internal
8703 } // namespace v8 8703 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698