| OLD | NEW |
| 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 3553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3564 } | 3564 } |
| 3565 | 3565 |
| 3566 | 3566 |
| 3567 static Local<Value> GetPropertyByLookup(i::LookupIterator* it) { | 3567 static Local<Value> GetPropertyByLookup(i::LookupIterator* it) { |
| 3568 // If the property being looked up is a callback, it can throw an exception. | 3568 // If the property being looked up is a callback, it can throw an exception. |
| 3569 EXCEPTION_PREAMBLE(it->isolate()); | 3569 EXCEPTION_PREAMBLE(it->isolate()); |
| 3570 i::Handle<i::Object> result; | 3570 i::Handle<i::Object> result; |
| 3571 has_pending_exception = !i::Object::GetProperty(it).ToHandle(&result); | 3571 has_pending_exception = !i::Object::GetProperty(it).ToHandle(&result); |
| 3572 EXCEPTION_BAILOUT_CHECK(it->isolate(), Local<Value>()); | 3572 EXCEPTION_BAILOUT_CHECK(it->isolate(), Local<Value>()); |
| 3573 | 3573 |
| 3574 return Utils::ToLocal(result); | 3574 if (it->IsFound()) return Utils::ToLocal(result); |
| 3575 return Local<Value>(); |
| 3575 } | 3576 } |
| 3576 | 3577 |
| 3577 | 3578 |
| 3578 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( | 3579 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( |
| 3579 Handle<String> key) { | 3580 Handle<String> key) { |
| 3580 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3581 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3581 ON_BAILOUT(isolate, | 3582 ON_BAILOUT(isolate, |
| 3582 "v8::Object::GetRealNamedPropertyInPrototypeChain()", | 3583 "v8::Object::GetRealNamedPropertyInPrototypeChain()", |
| 3583 return Local<Value>()); | 3584 return Local<Value>()); |
| 3584 ENTER_V8(isolate); | 3585 ENTER_V8(isolate); |
| 3585 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); | 3586 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
| 3586 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3587 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
| 3587 i::PrototypeIterator iter(isolate, self_obj); | 3588 i::PrototypeIterator iter(isolate, self_obj); |
| 3588 if (iter.IsAtEnd()) return Local<Value>(); | 3589 if (iter.IsAtEnd()) return Local<Value>(); |
| 3589 i::LookupIterator it(i::PrototypeIterator::GetCurrent(iter), key_obj, | 3590 i::LookupIterator it(i::PrototypeIterator::GetCurrent(iter), key_obj, |
| 3590 i::LookupIterator::CHECK_DERIVED_PROPERTY); | 3591 i::LookupIterator::CHECK_DERIVED_PROPERTY); |
| 3591 return GetPropertyByLookup(&it); | 3592 return GetPropertyByLookup(&it); |
| 3592 } | 3593 } |
| 3593 | 3594 |
| 3594 | 3595 |
| 3595 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { | 3596 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { |
| 3596 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3597 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3597 ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()", | 3598 ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()", |
| 3598 return Local<Value>()); | 3599 return Local<Value>()); |
| 3599 ENTER_V8(isolate); | 3600 ENTER_V8(isolate); |
| 3600 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); | 3601 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
| 3601 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3602 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
| 3602 i::LookupIterator it(self_obj, key_obj, | 3603 i::LookupIterator it(self_obj, key_obj, i::LookupIterator::CHECK_PROPERTY); |
| 3603 i::LookupIterator::CHECK_DERIVED_PROPERTY); | |
| 3604 return GetPropertyByLookup(&it); | 3604 return GetPropertyByLookup(&it); |
| 3605 } | 3605 } |
| 3606 | 3606 |
| 3607 | 3607 |
| 3608 // Turns on access checks by copying the map and setting the check flag. | 3608 // Turns on access checks by copying the map and setting the check flag. |
| 3609 // Because the object gets a new map, existing inline cache caching | 3609 // Because the object gets a new map, existing inline cache caching |
| 3610 // the old map of this object will fail. | 3610 // the old map of this object will fail. |
| 3611 void v8::Object::TurnOnAccessCheck() { | 3611 void v8::Object::TurnOnAccessCheck() { |
| 3612 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3612 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3613 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return); | 3613 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return); |
| (...skipping 4040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7654 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7654 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7655 Address callback_address = | 7655 Address callback_address = |
| 7656 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7656 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7657 VMState<EXTERNAL> state(isolate); | 7657 VMState<EXTERNAL> state(isolate); |
| 7658 ExternalCallbackScope call_scope(isolate, callback_address); | 7658 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7659 callback(info); | 7659 callback(info); |
| 7660 } | 7660 } |
| 7661 | 7661 |
| 7662 | 7662 |
| 7663 } } // namespace v8::internal | 7663 } } // namespace v8::internal |
| OLD | NEW |