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 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2612 } | 2612 } |
2613 | 2613 |
2614 | 2614 |
2615 static bool getBoolProperty(const StackFrame* f, const char* propertyName) { | 2615 static bool getBoolProperty(const StackFrame* f, const char* propertyName) { |
2616 i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate(); | 2616 i::Isolate* isolate = Utils::OpenHandle(f)->GetIsolate(); |
2617 ENTER_V8(isolate); | 2617 ENTER_V8(isolate); |
2618 i::HandleScope scope(isolate); | 2618 i::HandleScope scope(isolate); |
2619 i::Handle<i::JSObject> self = Utils::OpenHandle(f); | 2619 i::Handle<i::JSObject> self = Utils::OpenHandle(f); |
2620 i::Handle<i::Object> obj = | 2620 i::Handle<i::Object> obj = |
2621 i::JSReceiver::GetProperty(isolate, self, propertyName).ToHandleChecked(); | 2621 i::JSReceiver::GetProperty(isolate, self, propertyName).ToHandleChecked(); |
2622 return obj->IsTrue(); | 2622 return obj->IsTrue(isolate); |
2623 } | 2623 } |
2624 | 2624 |
2625 bool StackFrame::IsEval() const { return getBoolProperty(this, "isEval"); } | 2625 bool StackFrame::IsEval() const { return getBoolProperty(this, "isEval"); } |
2626 | 2626 |
2627 | 2627 |
2628 bool StackFrame::IsConstructor() const { | 2628 bool StackFrame::IsConstructor() const { |
2629 return getBoolProperty(this, "isConstructor"); | 2629 return getBoolProperty(this, "isConstructor"); |
2630 } | 2630 } |
2631 | 2631 |
2632 | 2632 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2780 Local<String> result; | 2780 Local<String> result; |
2781 has_pending_exception = | 2781 has_pending_exception = |
2782 !ToLocal<String>(i::Object::ToString(isolate, maybe), &result); | 2782 !ToLocal<String>(i::Object::ToString(isolate, maybe), &result); |
2783 RETURN_ON_FAILED_EXECUTION(String); | 2783 RETURN_ON_FAILED_EXECUTION(String); |
2784 RETURN_ESCAPED(result); | 2784 RETURN_ESCAPED(result); |
2785 } | 2785 } |
2786 | 2786 |
2787 // --- D a t a --- | 2787 // --- D a t a --- |
2788 | 2788 |
2789 bool Value::FullIsUndefined() const { | 2789 bool Value::FullIsUndefined() const { |
2790 bool result = Utils::OpenHandle(this)->IsUndefined(); | 2790 i::Handle<i::Object> object = Utils::OpenHandle(this); |
| 2791 bool result = false; |
| 2792 if (!object->IsSmi()) { |
| 2793 result = object->IsUndefined(i::HeapObject::cast(*object)->GetIsolate()); |
| 2794 } |
2791 DCHECK_EQ(result, QuickIsUndefined()); | 2795 DCHECK_EQ(result, QuickIsUndefined()); |
2792 return result; | 2796 return result; |
2793 } | 2797 } |
2794 | 2798 |
2795 | 2799 |
2796 bool Value::FullIsNull() const { | 2800 bool Value::FullIsNull() const { |
2797 bool result = Utils::OpenHandle(this)->IsNull(); | 2801 i::Handle<i::Object> object = Utils::OpenHandle(this); |
| 2802 bool result = false; |
| 2803 if (!object->IsSmi()) { |
| 2804 result = object->IsNull(i::HeapObject::cast(*object)->GetIsolate()); |
| 2805 } |
2798 DCHECK_EQ(result, QuickIsNull()); | 2806 DCHECK_EQ(result, QuickIsNull()); |
2799 return result; | 2807 return result; |
2800 } | 2808 } |
2801 | 2809 |
2802 | 2810 |
2803 bool Value::IsTrue() const { | 2811 bool Value::IsTrue() const { |
2804 return Utils::OpenHandle(this)->IsTrue(); | 2812 i::Handle<i::Object> object = Utils::OpenHandle(this); |
| 2813 if (object->IsSmi()) return false; |
| 2814 return object->IsTrue(i::HeapObject::cast(*object)->GetIsolate()); |
2805 } | 2815 } |
2806 | 2816 |
2807 | 2817 |
2808 bool Value::IsFalse() const { | 2818 bool Value::IsFalse() const { |
2809 return Utils::OpenHandle(this)->IsFalse(); | 2819 i::Handle<i::Object> object = Utils::OpenHandle(this); |
| 2820 if (object->IsSmi()) return false; |
| 2821 return object->IsFalse(i::HeapObject::cast(*object)->GetIsolate()); |
2810 } | 2822 } |
2811 | 2823 |
2812 | 2824 |
2813 bool Value::IsFunction() const { return Utils::OpenHandle(this)->IsCallable(); } | 2825 bool Value::IsFunction() const { return Utils::OpenHandle(this)->IsCallable(); } |
2814 | 2826 |
2815 | 2827 |
2816 bool Value::IsName() const { | 2828 bool Value::IsName() const { |
2817 return Utils::OpenHandle(this)->IsName(); | 2829 return Utils::OpenHandle(this)->IsName(); |
2818 } | 2830 } |
2819 | 2831 |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4048 i::Handle<i::JSObject>::cast(Utils::OpenHandle(self)); | 4060 i::Handle<i::JSObject>::cast(Utils::OpenHandle(self)); |
4049 v8::Local<AccessorSignature> signature; | 4061 v8::Local<AccessorSignature> signature; |
4050 auto info = MakeAccessorInfo(name, getter, setter, data, settings, attributes, | 4062 auto info = MakeAccessorInfo(name, getter, setter, data, settings, attributes, |
4051 signature, i::FLAG_disable_old_api_accessors); | 4063 signature, i::FLAG_disable_old_api_accessors); |
4052 if (info.is_null()) return Nothing<bool>(); | 4064 if (info.is_null()) return Nothing<bool>(); |
4053 bool fast = obj->HasFastProperties(); | 4065 bool fast = obj->HasFastProperties(); |
4054 i::Handle<i::Object> result; | 4066 i::Handle<i::Object> result; |
4055 has_pending_exception = | 4067 has_pending_exception = |
4056 !i::JSObject::SetAccessor(obj, info).ToHandle(&result); | 4068 !i::JSObject::SetAccessor(obj, info).ToHandle(&result); |
4057 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 4069 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
4058 if (result->IsUndefined()) return Nothing<bool>(); | 4070 if (result->IsUndefined(obj->GetIsolate())) return Nothing<bool>(); |
4059 if (fast) { | 4071 if (fast) { |
4060 i::JSObject::MigrateSlowToFast(obj, 0, "APISetAccessor"); | 4072 i::JSObject::MigrateSlowToFast(obj, 0, "APISetAccessor"); |
4061 } | 4073 } |
4062 return Just(true); | 4074 return Just(true); |
4063 } | 4075 } |
4064 | 4076 |
4065 | 4077 |
4066 Maybe<bool> Object::SetAccessor(Local<Context> context, Local<Name> name, | 4078 Maybe<bool> Object::SetAccessor(Local<Context> context, Local<Name> name, |
4067 AccessorNameGetterCallback getter, | 4079 AccessorNameGetterCallback getter, |
4068 AccessorNameSetterCallback setter, | 4080 AccessorNameSetterCallback setter, |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5338 | 5350 |
5339 | 5351 |
5340 double Number::Value() const { | 5352 double Number::Value() const { |
5341 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5353 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5342 return obj->Number(); | 5354 return obj->Number(); |
5343 } | 5355 } |
5344 | 5356 |
5345 | 5357 |
5346 bool Boolean::Value() const { | 5358 bool Boolean::Value() const { |
5347 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5359 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5348 return obj->IsTrue(); | 5360 return obj->IsTrue(i::HeapObject::cast(*obj)->GetIsolate()); |
5349 } | 5361 } |
5350 | 5362 |
5351 | 5363 |
5352 int64_t Integer::Value() const { | 5364 int64_t Integer::Value() const { |
5353 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 5365 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
5354 if (obj->IsSmi()) { | 5366 if (obj->IsSmi()) { |
5355 return i::Smi::cast(*obj)->value(); | 5367 return i::Smi::cast(*obj)->value(); |
5356 } else { | 5368 } else { |
5357 return static_cast<int64_t>(obj->Number()); | 5369 return static_cast<int64_t>(obj->Number()); |
5358 } | 5370 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5429 const char* location = "v8::Object::SetAlignedPointerInInternalField()"; | 5441 const char* location = "v8::Object::SetAlignedPointerInInternalField()"; |
5430 if (!InternalFieldOK(obj, index, location)) return; | 5442 if (!InternalFieldOK(obj, index, location)) return; |
5431 i::Handle<i::JSObject>::cast(obj) | 5443 i::Handle<i::JSObject>::cast(obj) |
5432 ->SetInternalField(index, EncodeAlignedAsSmi(value, location)); | 5444 ->SetInternalField(index, EncodeAlignedAsSmi(value, location)); |
5433 DCHECK_EQ(value, GetAlignedPointerFromInternalField(index)); | 5445 DCHECK_EQ(value, GetAlignedPointerFromInternalField(index)); |
5434 } | 5446 } |
5435 | 5447 |
5436 | 5448 |
5437 static void* ExternalValue(i::Object* obj) { | 5449 static void* ExternalValue(i::Object* obj) { |
5438 // Obscure semantics for undefined, but somehow checked in our unit tests... | 5450 // Obscure semantics for undefined, but somehow checked in our unit tests... |
5439 if (obj->IsUndefined()) return NULL; | 5451 if (!obj->IsSmi() && |
| 5452 obj->IsUndefined(i::HeapObject::cast(obj)->GetIsolate())) { |
| 5453 return NULL; |
| 5454 } |
5440 i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0); | 5455 i::Object* foreign = i::JSObject::cast(obj)->GetInternalField(0); |
5441 return i::Foreign::cast(foreign)->foreign_address(); | 5456 return i::Foreign::cast(foreign)->foreign_address(); |
5442 } | 5457 } |
5443 | 5458 |
5444 | 5459 |
5445 // --- E n v i r o n m e n t --- | 5460 // --- E n v i r o n m e n t --- |
5446 | 5461 |
5447 | 5462 |
5448 void v8::V8::InitializePlatform(Platform* platform) { | 5463 void v8::V8::InitializePlatform(Platform* platform) { |
5449 i::V8::InitializePlatform(platform); | 5464 i::V8::InitializePlatform(platform); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5678 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5693 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5679 i::Isolate* isolate = context->GetIsolate(); | 5694 i::Isolate* isolate = context->GetIsolate(); |
5680 ENTER_V8(isolate); | 5695 ENTER_V8(isolate); |
5681 context->set_allow_code_gen_from_strings( | 5696 context->set_allow_code_gen_from_strings( |
5682 allow ? isolate->heap()->true_value() : isolate->heap()->false_value()); | 5697 allow ? isolate->heap()->true_value() : isolate->heap()->false_value()); |
5683 } | 5698 } |
5684 | 5699 |
5685 | 5700 |
5686 bool Context::IsCodeGenerationFromStringsAllowed() { | 5701 bool Context::IsCodeGenerationFromStringsAllowed() { |
5687 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5702 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5688 return !context->allow_code_gen_from_strings()->IsFalse(); | 5703 return !context->allow_code_gen_from_strings()->IsFalse( |
| 5704 context->GetIsolate()); |
5689 } | 5705 } |
5690 | 5706 |
5691 | 5707 |
5692 void Context::SetErrorMessageForCodeGenerationFromStrings(Local<String> error) { | 5708 void Context::SetErrorMessageForCodeGenerationFromStrings(Local<String> error) { |
5693 i::Handle<i::Context> context = Utils::OpenHandle(this); | 5709 i::Handle<i::Context> context = Utils::OpenHandle(this); |
5694 i::Handle<i::String> error_handle = Utils::OpenHandle(*error); | 5710 i::Handle<i::String> error_handle = Utils::OpenHandle(*error); |
5695 context->set_error_message_for_code_gen_from_strings(*error_handle); | 5711 context->set_error_message_for_code_gen_from_strings(*error_handle); |
5696 } | 5712 } |
5697 | 5713 |
5698 | 5714 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6065 Local<v8::Value> v8::BooleanObject::New(bool value) { | 6081 Local<v8::Value> v8::BooleanObject::New(bool value) { |
6066 return New(Isolate::GetCurrent(), value); | 6082 return New(Isolate::GetCurrent(), value); |
6067 } | 6083 } |
6068 | 6084 |
6069 | 6085 |
6070 bool v8::BooleanObject::ValueOf() const { | 6086 bool v8::BooleanObject::ValueOf() const { |
6071 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 6087 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
6072 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); | 6088 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
6073 i::Isolate* isolate = jsvalue->GetIsolate(); | 6089 i::Isolate* isolate = jsvalue->GetIsolate(); |
6074 LOG_API(isolate, BooleanObject, BooleanValue); | 6090 LOG_API(isolate, BooleanObject, BooleanValue); |
6075 return jsvalue->value()->IsTrue(); | 6091 return jsvalue->value()->IsTrue(isolate); |
6076 } | 6092 } |
6077 | 6093 |
6078 | 6094 |
6079 Local<v8::Value> v8::StringObject::New(Local<String> value) { | 6095 Local<v8::Value> v8::StringObject::New(Local<String> value) { |
6080 i::Handle<i::String> string = Utils::OpenHandle(*value); | 6096 i::Handle<i::String> string = Utils::OpenHandle(*value); |
6081 i::Isolate* isolate = string->GetIsolate(); | 6097 i::Isolate* isolate = string->GetIsolate(); |
6082 LOG_API(isolate, StringObject, New); | 6098 LOG_API(isolate, StringObject, New); |
6083 ENTER_V8(isolate); | 6099 ENTER_V8(isolate); |
6084 i::Handle<i::Object> obj = | 6100 i::Handle<i::Object> obj = |
6085 i::Object::ToObject(isolate, string).ToHandleChecked(); | 6101 i::Object::ToObject(isolate, string).ToHandleChecked(); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6312 | 6328 |
6313 Maybe<bool> Map::Has(Local<Context> context, Local<Value> key) { | 6329 Maybe<bool> Map::Has(Local<Context> context, Local<Value> key) { |
6314 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Map, Has, bool); | 6330 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Map, Has, bool); |
6315 auto self = Utils::OpenHandle(this); | 6331 auto self = Utils::OpenHandle(this); |
6316 i::Handle<i::Object> result; | 6332 i::Handle<i::Object> result; |
6317 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; | 6333 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; |
6318 has_pending_exception = !i::Execution::Call(isolate, isolate->map_has(), self, | 6334 has_pending_exception = !i::Execution::Call(isolate, isolate->map_has(), self, |
6319 arraysize(argv), argv) | 6335 arraysize(argv), argv) |
6320 .ToHandle(&result); | 6336 .ToHandle(&result); |
6321 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 6337 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
6322 return Just(result->IsTrue()); | 6338 return Just(result->IsTrue(isolate)); |
6323 } | 6339 } |
6324 | 6340 |
6325 | 6341 |
6326 Maybe<bool> Map::Delete(Local<Context> context, Local<Value> key) { | 6342 Maybe<bool> Map::Delete(Local<Context> context, Local<Value> key) { |
6327 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Map, Delete, bool); | 6343 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Map, Delete, bool); |
6328 auto self = Utils::OpenHandle(this); | 6344 auto self = Utils::OpenHandle(this); |
6329 i::Handle<i::Object> result; | 6345 i::Handle<i::Object> result; |
6330 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; | 6346 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; |
6331 has_pending_exception = !i::Execution::Call(isolate, isolate->map_delete(), | 6347 has_pending_exception = !i::Execution::Call(isolate, isolate->map_delete(), |
6332 self, arraysize(argv), argv) | 6348 self, arraysize(argv), argv) |
6333 .ToHandle(&result); | 6349 .ToHandle(&result); |
6334 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 6350 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
6335 return Just(result->IsTrue()); | 6351 return Just(result->IsTrue(isolate)); |
6336 } | 6352 } |
6337 | 6353 |
6338 | 6354 |
6339 Local<Array> Map::AsArray() const { | 6355 Local<Array> Map::AsArray() const { |
6340 i::Handle<i::JSMap> obj = Utils::OpenHandle(this); | 6356 i::Handle<i::JSMap> obj = Utils::OpenHandle(this); |
6341 i::Isolate* isolate = obj->GetIsolate(); | 6357 i::Isolate* isolate = obj->GetIsolate(); |
6342 i::Factory* factory = isolate->factory(); | 6358 i::Factory* factory = isolate->factory(); |
6343 LOG_API(isolate, Map, AsArray); | 6359 LOG_API(isolate, Map, AsArray); |
6344 ENTER_V8(isolate); | 6360 ENTER_V8(isolate); |
6345 i::Handle<i::OrderedHashMap> table(i::OrderedHashMap::cast(obj->table())); | 6361 i::Handle<i::OrderedHashMap> table(i::OrderedHashMap::cast(obj->table())); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6404 | 6420 |
6405 Maybe<bool> Set::Has(Local<Context> context, Local<Value> key) { | 6421 Maybe<bool> Set::Has(Local<Context> context, Local<Value> key) { |
6406 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Set, Has, bool); | 6422 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Set, Has, bool); |
6407 auto self = Utils::OpenHandle(this); | 6423 auto self = Utils::OpenHandle(this); |
6408 i::Handle<i::Object> result; | 6424 i::Handle<i::Object> result; |
6409 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; | 6425 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; |
6410 has_pending_exception = !i::Execution::Call(isolate, isolate->set_has(), self, | 6426 has_pending_exception = !i::Execution::Call(isolate, isolate->set_has(), self, |
6411 arraysize(argv), argv) | 6427 arraysize(argv), argv) |
6412 .ToHandle(&result); | 6428 .ToHandle(&result); |
6413 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 6429 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
6414 return Just(result->IsTrue()); | 6430 return Just(result->IsTrue(isolate)); |
6415 } | 6431 } |
6416 | 6432 |
6417 | 6433 |
6418 Maybe<bool> Set::Delete(Local<Context> context, Local<Value> key) { | 6434 Maybe<bool> Set::Delete(Local<Context> context, Local<Value> key) { |
6419 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Set, Delete, bool); | 6435 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Set, Delete, bool); |
6420 auto self = Utils::OpenHandle(this); | 6436 auto self = Utils::OpenHandle(this); |
6421 i::Handle<i::Object> result; | 6437 i::Handle<i::Object> result; |
6422 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; | 6438 i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)}; |
6423 has_pending_exception = !i::Execution::Call(isolate, isolate->set_delete(), | 6439 has_pending_exception = !i::Execution::Call(isolate, isolate->set_delete(), |
6424 self, arraysize(argv), argv) | 6440 self, arraysize(argv), argv) |
6425 .ToHandle(&result); | 6441 .ToHandle(&result); |
6426 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); | 6442 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); |
6427 return Just(result->IsTrue()); | 6443 return Just(result->IsTrue(isolate)); |
6428 } | 6444 } |
6429 | 6445 |
6430 | 6446 |
6431 Local<Array> Set::AsArray() const { | 6447 Local<Array> Set::AsArray() const { |
6432 i::Handle<i::JSSet> obj = Utils::OpenHandle(this); | 6448 i::Handle<i::JSSet> obj = Utils::OpenHandle(this); |
6433 i::Isolate* isolate = obj->GetIsolate(); | 6449 i::Isolate* isolate = obj->GetIsolate(); |
6434 i::Factory* factory = isolate->factory(); | 6450 i::Factory* factory = isolate->factory(); |
6435 LOG_API(isolate, Set, AsArray); | 6451 LOG_API(isolate, Set, AsArray); |
6436 ENTER_V8(isolate); | 6452 ENTER_V8(isolate); |
6437 i::Handle<i::OrderedHashSet> table(i::OrderedHashSet::cast(obj->table())); | 6453 i::Handle<i::OrderedHashSet> table(i::OrderedHashSet::cast(obj->table())); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6591 RETURN_TO_LOCAL_UNCHECKED(Then(context, handler), Promise); | 6607 RETURN_TO_LOCAL_UNCHECKED(Then(context, handler), Promise); |
6592 } | 6608 } |
6593 | 6609 |
6594 | 6610 |
6595 bool Promise::HasHandler() { | 6611 bool Promise::HasHandler() { |
6596 i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this); | 6612 i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this); |
6597 i::Isolate* isolate = promise->GetIsolate(); | 6613 i::Isolate* isolate = promise->GetIsolate(); |
6598 LOG_API(isolate, Promise, HasRejectHandler); | 6614 LOG_API(isolate, Promise, HasRejectHandler); |
6599 ENTER_V8(isolate); | 6615 ENTER_V8(isolate); |
6600 i::Handle<i::Symbol> key = isolate->factory()->promise_has_handler_symbol(); | 6616 i::Handle<i::Symbol> key = isolate->factory()->promise_has_handler_symbol(); |
6601 return i::JSReceiver::GetDataProperty(promise, key)->IsTrue(); | 6617 return i::JSReceiver::GetDataProperty(promise, key)->IsTrue(isolate); |
6602 } | 6618 } |
6603 | 6619 |
6604 | 6620 |
6605 Local<Object> Proxy::GetTarget() { | 6621 Local<Object> Proxy::GetTarget() { |
6606 i::Handle<i::JSProxy> self = Utils::OpenHandle(this); | 6622 i::Handle<i::JSProxy> self = Utils::OpenHandle(this); |
6607 i::Handle<i::JSReceiver> target(self->target()); | 6623 i::Handle<i::JSReceiver> target(self->target()); |
6608 return Utils::ToLocal(target); | 6624 return Utils::ToLocal(target); |
6609 } | 6625 } |
6610 | 6626 |
6611 | 6627 |
(...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8809 Address callback_address = | 8825 Address callback_address = |
8810 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8826 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8811 VMState<EXTERNAL> state(isolate); | 8827 VMState<EXTERNAL> state(isolate); |
8812 ExternalCallbackScope call_scope(isolate, callback_address); | 8828 ExternalCallbackScope call_scope(isolate, callback_address); |
8813 callback(info); | 8829 callback(info); |
8814 } | 8830 } |
8815 | 8831 |
8816 | 8832 |
8817 } // namespace internal | 8833 } // namespace internal |
8818 } // namespace v8 | 8834 } // namespace v8 |
OLD | NEW |