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 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2596 } | 2596 } |
2597 | 2597 |
2598 | 2598 |
2599 static bool getBoolProperty(const StackFrame* f, const char* propertyName) { | 2599 static bool getBoolProperty(const StackFrame* f, const char* propertyName) { |
2600 i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate(); | 2600 i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate(); |
2601 ENTER_V8(isolate); | 2601 ENTER_V8(isolate); |
2602 i::HandleScope scope(isolate); | 2602 i::HandleScope scope(isolate); |
2603 i::Handle<i::JSObject> self = Utils::OpenHandle(f); | 2603 i::Handle<i::JSObject> self = Utils::OpenHandle(f); |
2604 i::Handle<i::Object> obj = | 2604 i::Handle<i::Object> obj = |
2605 i::JSReceiver::GetProperty(isolate, self, propertyName).ToHandleChecked(); | 2605 i::JSReceiver::GetProperty(isolate, self, propertyName).ToHandleChecked(); |
2606 return obj->IsTrue(); | 2606 return obj->IsTrue(isolate); |
2607 } | 2607 } |
2608 | 2608 |
2609 bool StackFrame::IsEval() const { return getBoolProperty(this, "isEval"); } | 2609 bool StackFrame::IsEval() const { return getBoolProperty(this, "isEval"); } |
2610 | 2610 |
2611 | 2611 |
2612 bool StackFrame::IsConstructor() const { | 2612 bool StackFrame::IsConstructor() const { |
2613 return getBoolProperty(this, "isConstructor"); | 2613 return getBoolProperty(this, "isConstructor"); |
2614 } | 2614 } |
2615 | 2615 |
2616 | 2616 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2764 Local<String> result; | 2764 Local<String> result; |
2765 has_pending_exception = | 2765 has_pending_exception = |
2766 !ToLocal<String>(i::Object::ToString(isolate, maybe), &result); | 2766 !ToLocal<String>(i::Object::ToString(isolate, maybe), &result); |
2767 RETURN_ON_FAILED_EXECUTION(String); | 2767 RETURN_ON_FAILED_EXECUTION(String); |
2768 RETURN_ESCAPED(result); | 2768 RETURN_ESCAPED(result); |
2769 } | 2769 } |
2770 | 2770 |
2771 // --- D a t a --- | 2771 // --- D a t a --- |
2772 | 2772 |
2773 bool Value::FullIsUndefined() const { | 2773 bool Value::FullIsUndefined() const { |
2774 bool result = Utils::OpenHandle(this)->IsUndefined(); | 2774 i::Handle<i::Object> object = Utils::OpenHandle(this); |
| 2775 bool result = false; |
| 2776 if (!object->IsSmi()) { |
| 2777 result = object->IsUndefined(i::HeapObject::cast(*object)->GetIsolate()); |
| 2778 } |
2775 DCHECK_EQ(result, QuickIsUndefined()); | 2779 DCHECK_EQ(result, QuickIsUndefined()); |
2776 return result; | 2780 return result; |
2777 } | 2781 } |
2778 | 2782 |
2779 | 2783 |
2780 bool Value::FullIsNull() const { | 2784 bool Value::FullIsNull() const { |
2781 bool result = Utils::OpenHandle(this)->IsNull(); | 2785 i::Handle<i::Object> object = Utils::OpenHandle(this); |
| 2786 bool result = false; |
| 2787 if (!object->IsSmi()) { |
| 2788 result = object->IsNull(i::HeapObject::cast(*object)->GetIsolate()); |
| 2789 } |
2782 DCHECK_EQ(result, QuickIsNull()); | 2790 DCHECK_EQ(result, QuickIsNull()); |
2783 return result; | 2791 return result; |
2784 } | 2792 } |
2785 | 2793 |
2786 | 2794 |
2787 bool Value::IsTrue() const { | 2795 bool Value::IsTrue() const { |
2788 return Utils::OpenHandle(this)->IsTrue(); | 2796 i::Handle<i::Object> object = Utils::OpenHandle(this); |
| 2797 if (object->IsSmi()) return false; |
| 2798 return object->IsTrue(i::HeapObject::cast(*object)->GetIsolate()); |
2789 } | 2799 } |
2790 | 2800 |
2791 | 2801 |
2792 bool Value::IsFalse() const { | 2802 bool Value::IsFalse() const { |
2793 return Utils::OpenHandle(this)->IsFalse(); | 2803 i::Handle<i::Object> object = Utils::OpenHandle(this); |
| 2804 if (object->IsSmi()) return false; |
| 2805 return object->IsFalse(i::HeapObject::cast(*object)->GetIsolate()); |
2794 } | 2806 } |
2795 | 2807 |
2796 | 2808 |
2797 bool Value::IsFunction() const { return Utils::OpenHandle(this)->IsCallable(); } | 2809 bool Value::IsFunction() const { return Utils::OpenHandle(this)->IsCallable(); } |
2798 | 2810 |
2799 | 2811 |
2800 bool Value::IsName() const { | 2812 bool Value::IsName() const { |
2801 return Utils::OpenHandle(this)->IsName(); | 2813 return Utils::OpenHandle(this)->IsName(); |
2802 } | 2814 } |
2803 | 2815 |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4032 i::Handle<i::JSObject>::cast(Utils::OpenHandle(self)); | 4044 i::Handle<i::JSObject>::cast(Utils::OpenHandle(self)); |
4033 v8::Local<AccessorSignature> signature; | 4045 v8::Local<AccessorSignature> signature; |
4034 auto info = MakeAccessorInfo(name, getter, setter, data, settings, attributes, | 4046 auto info = MakeAccessorInfo(name, getter, setter, data, settings, attributes, |
4035 signature, i::FLAG_disable_old_api_accessors); | 4047 signature, i::FLAG_disable_old_api_accessors); |
4036 if (info.is_null()) return Nothing<bool>(); | 4048 if (info.is_null()) return Nothing<bool>(); |
4037 bool fast = obj->HasFastProperties(); | 4049 bool fast = obj->HasFastProperties(); |
4038 i::Handle<i::Object> result; | 4050 i::Handle<i::Object> result; |
4039 has_pending_exception = | 4051 has_pending_exception = |
4040 !i::JSObject::SetAccessor(obj, info).ToHandle(&result); | 4052 !i::JSObject::SetAccessor(obj, info).ToHandle(&result); |
4041 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 4053 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
4042 if (result->IsUndefined()) return Nothing<bool>(); | 4054 if (result->IsUndefined(obj->GetIsolate())) return Nothing<bool>(); |
4043 if (fast) { | 4055 if (fast) { |
4044 i::JSObject::MigrateSlowToFast(obj, 0, "APISetAccessor"); | 4056 i::JSObject::MigrateSlowToFast(obj, 0, "APISetAccessor"); |
4045 } | 4057 } |
4046 return Just(true); | 4058 return Just(true); |
4047 } | 4059 } |
4048 | 4060 |
4049 | 4061 |
4050 Maybe<bool> Object::SetAccessor(Local<Context> context, Local<Name> name, | 4062 Maybe<bool> Object::SetAccessor(Local<Context> context, Local<Name> name, |
4051 AccessorNameGetterCallback getter, | 4063 AccessorNameGetterCallback getter, |
4052 AccessorNameSetterCallback setter, | 4064 AccessorNameSetterCallback setter, |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5322 | 5334 |
5323 | 5335 |
5324 double Number::Value() const { | 5336 double Number::Value() const { |
5325 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5337 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5326 return obj->Number(); | 5338 return obj->Number(); |
5327 } | 5339 } |
5328 | 5340 |
5329 | 5341 |
5330 bool Boolean::Value() const { | 5342 bool Boolean::Value() const { |
5331 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5343 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5332 return obj->IsTrue(); | 5344 return obj->IsTrue(i::HeapObject::cast(*obj)->GetIsolate()); |
5333 } | 5345 } |
5334 | 5346 |
5335 | 5347 |
5336 int64_t Integer::Value() const { | 5348 int64_t Integer::Value() const { |
5337 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5349 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5338 if (obj->IsSmi()) { | 5350 if (obj->IsSmi()) { |
5339 return i::Smi::cast(*obj)->value(); | 5351 return i::Smi::cast(*obj)->value(); |
5340 } else { | 5352 } else { |
5341 return static_cast<int64_t>(obj->Number()); | 5353 return static_cast<int64_t>(obj->Number()); |
5342 } | 5354 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5413 const char* location = "v8::Object::SetAlignedPointerInInternalField()"; | 5425 const char* location = "v8::Object::SetAlignedPointerInInternalField()"; |
5414 if (!InternalFieldOK(obj, index, location)) return; | 5426 if (!InternalFieldOK(obj, index, location)) return; |
5415 i::Handle<i::JSObject>::cast(obj) | 5427 i::Handle<i::JSObject>::cast(obj) |
5416 ->SetInternalField(index, EncodeAlignedAsSmi(value, location)); | 5428 ->SetInternalField(index, EncodeAlignedAsSmi(value, location)); |
5417 DCHECK_EQ(value, GetAlignedPointerFromInternalField(index)); | 5429 DCHECK_EQ(value, GetAlignedPointerFromInternalField(index)); |
5418 } | 5430 } |
5419 | 5431 |
5420 | 5432 |
5421 static void* ExternalValue(i::Object* obj) { | 5433 static void* ExternalValue(i::Object* obj) { |
5422 // Obscure semantics for undefined, but somehow checked in our unit tests... | 5434 // Obscure semantics for undefined, but somehow checked in our unit tests... |
5423 if (obj->IsUndefined()) return NULL; | 5435 if (!obj->IsSmi() && |
| 5436 obj->IsUndefined(i::HeapObject::cast(obj)->GetIsolate())) { |
| 5437 return NULL; |
| 5438 } |
5424 i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0); | 5439 i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0); |
5425 return i::Foreign::cast(foreign)->foreign_address(); | 5440 return i::Foreign::cast(foreign)->foreign_address(); |
5426 } | 5441 } |
5427 | 5442 |
5428 | 5443 |
5429 // --- E n v i r o n m e n t --- | 5444 // --- E n v i r o n m e n t --- |
5430 | 5445 |
5431 | 5446 |
5432 void v8::V8::InitializePlatform(Platform* platform) { | 5447 void v8::V8::InitializePlatform(Platform* platform) { |
5433 i::V8::InitializePlatform(platform); | 5448 i::V8::InitializePlatform(platform); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5666 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5681 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5667 i::Isolate* isolate = context->GetIsolate(); | 5682 i::Isolate* isolate = context->GetIsolate(); |
5668 ENTER_V8(isolate); | 5683 ENTER_V8(isolate); |
5669 context->set_allow_code_gen_from_strings( | 5684 context->set_allow_code_gen_from_strings( |
5670 allow ? isolate->heap()->true_value() : isolate->heap()->false_value()); | 5685 allow ? isolate->heap()->true_value() : isolate->heap()->false_value()); |
5671 } | 5686 } |
5672 | 5687 |
5673 | 5688 |
5674 bool Context::IsCodeGenerationFromStringsAllowed() { | 5689 bool Context::IsCodeGenerationFromStringsAllowed() { |
5675 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5690 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5676 return !context->allow_code_gen_from_strings()->IsFalse(); | 5691 return !context->allow_code_gen_from_strings()->IsFalse( |
| 5692 context->GetIsolate()); |
5677 } | 5693 } |
5678 | 5694 |
5679 | 5695 |
5680 void Context::SetErrorMessageForCodeGenerationFromStrings(Local<String> error) { | 5696 void Context::SetErrorMessageForCodeGenerationFromStrings(Local<String> error) { |
5681 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5697 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5682 i::Handle<i::String> error_handle = Utils::OpenHandle(*error); | 5698 i::Handle<i::String> error_handle = Utils::OpenHandle(*error); |
5683 context->set_error_message_for_code_gen_from_strings(*error_handle); | 5699 context->set_error_message_for_code_gen_from_strings(*error_handle); |
5684 } | 5700 } |
5685 | 5701 |
5686 | 5702 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6050 Local<v8::Value> v8::BooleanObject::New(bool value) { | 6066 Local<v8::Value> v8::BooleanObject::New(bool value) { |
6051 return New(Isolate::GetCurrent(), value); | 6067 return New(Isolate::GetCurrent(), value); |
6052 } | 6068 } |
6053 | 6069 |
6054 | 6070 |
6055 bool v8::BooleanObject::ValueOf() const { | 6071 bool v8::BooleanObject::ValueOf() const { |
6056 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 6072 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
6057 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); | 6073 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
6058 i::Isolate* isolate = jsvalue->GetIsolate(); | 6074 i::Isolate* isolate = jsvalue->GetIsolate(); |
6059 LOG_API(isolate, BooleanObject, BooleanValue); | 6075 LOG_API(isolate, BooleanObject, BooleanValue); |
6060 return jsvalue->value()->IsTrue(); | 6076 return jsvalue->value()->IsTrue(isolate); |
6061 } | 6077 } |
6062 | 6078 |
6063 | 6079 |
6064 Local<v8::Value> v8::StringObject::New(Local<String> value) { | 6080 Local<v8::Value> v8::StringObject::New(Local<String> value) { |
6065 i::Handle<i::String> string = Utils::OpenHandle(*value); | 6081 i::Handle<i::String> string = Utils::OpenHandle(*value); |
6066 i::Isolate* isolate = string->GetIsolate(); | 6082 i::Isolate* isolate = string->GetIsolate(); |
6067 LOG_API(isolate, StringObject, New); | 6083 LOG_API(isolate, StringObject, New); |
6068 ENTER_V8(isolate); | 6084 ENTER_V8(isolate); |
6069 i::Handle<i::Object> obj = | 6085 i::Handle<i::Object> obj = |
6070 i::Object::ToObject(isolate, string).ToHandleChecked(); | 6086 i::Object::ToObject(isolate, string).ToHandleChecked(); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6297 | 6313 |
6298 Maybe<bool> Map::Has(Local<Context> context, Local<Value> key) { | 6314 Maybe<bool> Map::Has(Local<Context> context, Local<Value> key) { |
6299 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Map, Has, bool); | 6315 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Map, Has, bool); |
6300 auto self = Utils::OpenHandle(this); | 6316 auto self = Utils::OpenHandle(this); |
6301 i::Handle<i::Object> result; | 6317 i::Handle<i::Object> result; |
6302 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; | 6318 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; |
6303 has_pending_exception = !i::Execution::Call(isolate, isolate->map_has(), self, | 6319 has_pending_exception = !i::Execution::Call(isolate, isolate->map_has(), self, |
6304 arraysize(argv), argv) | 6320 arraysize(argv), argv) |
6305 .ToHandle(&result); | 6321 .ToHandle(&result); |
6306 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 6322 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
6307 return Just(result->IsTrue()); | 6323 return Just(result->IsTrue(isolate)); |
6308 } | 6324 } |
6309 | 6325 |
6310 | 6326 |
6311 Maybe<bool> Map::Delete(Local<Context> context, Local<Value> key) { | 6327 Maybe<bool> Map::Delete(Local<Context> context, Local<Value> key) { |
6312 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Map, Delete, bool); | 6328 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Map, Delete, bool); |
6313 auto self = Utils::OpenHandle(this); | 6329 auto self = Utils::OpenHandle(this); |
6314 i::Handle<i::Object> result; | 6330 i::Handle<i::Object> result; |
6315 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; | 6331 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; |
6316 has_pending_exception = !i::Execution::Call(isolate, isolate->map_delete(), | 6332 has_pending_exception = !i::Execution::Call(isolate, isolate->map_delete(), |
6317 self, arraysize(argv), argv) | 6333 self, arraysize(argv), argv) |
6318 .ToHandle(&result); | 6334 .ToHandle(&result); |
6319 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 6335 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
6320 return Just(result->IsTrue()); | 6336 return Just(result->IsTrue(isolate)); |
6321 } | 6337 } |
6322 | 6338 |
6323 | 6339 |
6324 Local<Array> Map::AsArray() const { | 6340 Local<Array> Map::AsArray() const { |
6325 i::Handle<i::JSMap> obj = Utils::OpenHandle(this); | 6341 i::Handle<i::JSMap> obj = Utils::OpenHandle(this); |
6326 i::Isolate* isolate = obj->GetIsolate(); | 6342 i::Isolate* isolate = obj->GetIsolate(); |
6327 i::Factory* factory = isolate->factory(); | 6343 i::Factory* factory = isolate->factory(); |
6328 LOG_API(isolate, Map, AsArray); | 6344 LOG_API(isolate, Map, AsArray); |
6329 ENTER_V8(isolate); | 6345 ENTER_V8(isolate); |
6330 i::Handle<i::OrderedHashMap> table(i::OrderedHashMap::cast(obj->table())); | 6346 i::Handle<i::OrderedHashMap> table(i::OrderedHashMap::cast(obj->table())); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6389 | 6405 |
6390 Maybe<bool> Set::Has(Local<Context> context, Local<Value> key) { | 6406 Maybe<bool> Set::Has(Local<Context> context, Local<Value> key) { |
6391 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Set, Has, bool); | 6407 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Set, Has, bool); |
6392 auto self = Utils::OpenHandle(this); | 6408 auto self = Utils::OpenHandle(this); |
6393 i::Handle<i::Object> result; | 6409 i::Handle<i::Object> result; |
6394 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; | 6410 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; |
6395 has_pending_exception = !i::Execution::Call(isolate, isolate->set_has(), self, | 6411 has_pending_exception = !i::Execution::Call(isolate, isolate->set_has(), self, |
6396 arraysize(argv), argv) | 6412 arraysize(argv), argv) |
6397 .ToHandle(&result); | 6413 .ToHandle(&result); |
6398 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 6414 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
6399 return Just(result->IsTrue()); | 6415 return Just(result->IsTrue(isolate)); |
6400 } | 6416 } |
6401 | 6417 |
6402 | 6418 |
6403 Maybe<bool> Set::Delete(Local<Context> context, Local<Value> key) { | 6419 Maybe<bool> Set::Delete(Local<Context> context, Local<Value> key) { |
6404 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Set, Delete, bool); | 6420 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Set, Delete, bool); |
6405 auto self = Utils::OpenHandle(this); | 6421 auto self = Utils::OpenHandle(this); |
6406 i::Handle<i::Object> result; | 6422 i::Handle<i::Object> result; |
6407 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; | 6423 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; |
6408 has_pending_exception = !i::Execution::Call(isolate, isolate->set_delete(), | 6424 has_pending_exception = !i::Execution::Call(isolate, isolate->set_delete(), |
6409 self, arraysize(argv), argv) | 6425 self, arraysize(argv), argv) |
6410 .ToHandle(&result); | 6426 .ToHandle(&result); |
6411 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 6427 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
6412 return Just(result->IsTrue()); | 6428 return Just(result->IsTrue(isolate)); |
6413 } | 6429 } |
6414 | 6430 |
6415 | 6431 |
6416 Local<Array> Set::AsArray() const { | 6432 Local<Array> Set::AsArray() const { |
6417 i::Handle<i::JSSet> obj = Utils::OpenHandle(this); | 6433 i::Handle<i::JSSet> obj = Utils::OpenHandle(this); |
6418 i::Isolate* isolate = obj->GetIsolate(); | 6434 i::Isolate* isolate = obj->GetIsolate(); |
6419 i::Factory* factory = isolate->factory(); | 6435 i::Factory* factory = isolate->factory(); |
6420 LOG_API(isolate, Set, AsArray); | 6436 LOG_API(isolate, Set, AsArray); |
6421 ENTER_V8(isolate); | 6437 ENTER_V8(isolate); |
6422 i::Handle<i::OrderedHashSet> table(i::OrderedHashSet::cast(obj->table())); | 6438 i::Handle<i::OrderedHashSet> table(i::OrderedHashSet::cast(obj->table())); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6576 RETURN_TO_LOCAL_UNCHECKED(Then(context, handler), Promise); | 6592 RETURN_TO_LOCAL_UNCHECKED(Then(context, handler), Promise); |
6577 } | 6593 } |
6578 | 6594 |
6579 | 6595 |
6580 bool Promise::HasHandler() { | 6596 bool Promise::HasHandler() { |
6581 i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this); | 6597 i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this); |
6582 i::Isolate* isolate = promise->GetIsolate(); | 6598 i::Isolate* isolate = promise->GetIsolate(); |
6583 LOG_API(isolate, Promise, HasRejectHandler); | 6599 LOG_API(isolate, Promise, HasRejectHandler); |
6584 ENTER_V8(isolate); | 6600 ENTER_V8(isolate); |
6585 i::Handle<i::Symbol> key = isolate->factory()->promise_has_handler_symbol(); | 6601 i::Handle<i::Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
6586 return i::JSReceiver::GetDataProperty(promise, key)->IsTrue(); | 6602 return i::JSReceiver::GetDataProperty(promise, key)->IsTrue(isolate); |
6587 } | 6603 } |
6588 | 6604 |
6589 | 6605 |
6590 Local<Object> Proxy::GetTarget() { | 6606 Local<Object> Proxy::GetTarget() { |
6591 i::Handle<i::JSProxy> self = Utils::OpenHandle(this); | 6607 i::Handle<i::JSProxy> self = Utils::OpenHandle(this); |
6592 i::Handle<i::JSReceiver> target(self->target()); | 6608 i::Handle<i::JSReceiver> target(self->target()); |
6593 return Utils::ToLocal(target); | 6609 return Utils::ToLocal(target); |
6594 } | 6610 } |
6595 | 6611 |
6596 | 6612 |
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8794 Address callback_address = | 8810 Address callback_address = |
8795 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8811 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8796 VMState<EXTERNAL> state(isolate); | 8812 VMState<EXTERNAL> state(isolate); |
8797 ExternalCallbackScope call_scope(isolate, callback_address); | 8813 ExternalCallbackScope call_scope(isolate, callback_address); |
8798 callback(info); | 8814 callback(info); |
8799 } | 8815 } |
8800 | 8816 |
8801 | 8817 |
8802 } // namespace internal | 8818 } // namespace internal |
8803 } // namespace v8 | 8819 } // namespace v8 |
OLD | NEW |