| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 return *isolate->factory()->NewJSArrayWithElements(keys); | 523 return *isolate->factory()->NewJSArrayWithElements(keys); |
| 524 } | 524 } |
| 525 | 525 |
| 526 | 526 |
| 527 // Return information on whether an object has a named or indexed interceptor. | 527 // Return information on whether an object has a named or indexed interceptor. |
| 528 // args[0]: object | 528 // args[0]: object |
| 529 RUNTIME_FUNCTION(Runtime_GetInterceptorInfo) { | 529 RUNTIME_FUNCTION(Runtime_GetInterceptorInfo) { |
| 530 HandleScope scope(isolate); | 530 HandleScope scope(isolate); |
| 531 DCHECK(args.length() == 1); | 531 DCHECK(args.length() == 1); |
| 532 if (!args[0]->IsJSObject()) { | 532 if (!args[0]->IsJSObject()) { |
| 533 return Smi::kZero; | 533 return Smi::FromInt(0); |
| 534 } | 534 } |
| 535 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 535 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
| 536 | 536 |
| 537 int result = 0; | 537 int result = 0; |
| 538 if (obj->HasNamedInterceptor()) result |= 2; | 538 if (obj->HasNamedInterceptor()) result |= 2; |
| 539 if (obj->HasIndexedInterceptor()) result |= 1; | 539 if (obj->HasIndexedInterceptor()) result |= 1; |
| 540 | 540 |
| 541 return Smi::FromInt(result); | 541 return Smi::FromInt(result); |
| 542 } | 542 } |
| 543 | 543 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 } | 597 } |
| 598 return *JSObject::FastPropertyAt(object, Representation::Double(), | 598 return *JSObject::FastPropertyAt(object, Representation::Double(), |
| 599 field_index); | 599 field_index); |
| 600 } | 600 } |
| 601 | 601 |
| 602 | 602 |
| 603 RUNTIME_FUNCTION(Runtime_TryMigrateInstance) { | 603 RUNTIME_FUNCTION(Runtime_TryMigrateInstance) { |
| 604 HandleScope scope(isolate); | 604 HandleScope scope(isolate); |
| 605 DCHECK(args.length() == 1); | 605 DCHECK(args.length() == 1); |
| 606 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 606 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 607 if (!object->IsJSObject()) return Smi::kZero; | 607 if (!object->IsJSObject()) return Smi::FromInt(0); |
| 608 Handle<JSObject> js_object = Handle<JSObject>::cast(object); | 608 Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
| 609 if (!js_object->map()->is_deprecated()) return Smi::kZero; | 609 if (!js_object->map()->is_deprecated()) return Smi::FromInt(0); |
| 610 // This call must not cause lazy deopts, because it's called from deferred | 610 // This call must not cause lazy deopts, because it's called from deferred |
| 611 // code where we can't handle lazy deopts for lack of a suitable bailout | 611 // code where we can't handle lazy deopts for lack of a suitable bailout |
| 612 // ID. So we just try migration and signal failure if necessary, | 612 // ID. So we just try migration and signal failure if necessary, |
| 613 // which will also trigger a deopt. | 613 // which will also trigger a deopt. |
| 614 if (!JSObject::TryMigrateInstance(js_object)) return Smi::kZero; | 614 if (!JSObject::TryMigrateInstance(js_object)) return Smi::FromInt(0); |
| 615 return *object; | 615 return *object; |
| 616 } | 616 } |
| 617 | 617 |
| 618 | 618 |
| 619 RUNTIME_FUNCTION(Runtime_IsJSGlobalProxy) { | 619 RUNTIME_FUNCTION(Runtime_IsJSGlobalProxy) { |
| 620 SealHandleScope shs(isolate); | 620 SealHandleScope shs(isolate); |
| 621 DCHECK(args.length() == 1); | 621 DCHECK(args.length() == 1); |
| 622 CONVERT_ARG_CHECKED(Object, obj, 0); | 622 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 623 return isolate->heap()->ToBoolean(obj->IsJSGlobalProxy()); | 623 return isolate->heap()->ToBoolean(obj->IsJSGlobalProxy()); |
| 624 } | 624 } |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 DCHECK(args.length() == 2); | 982 DCHECK(args.length() == 2); |
| 983 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 983 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 984 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 984 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 985 Handle<Module> module(isolate->context()->module()); | 985 Handle<Module> module(isolate->context()->module()); |
| 986 Module::StoreExport(module, name, value); | 986 Module::StoreExport(module, name, value); |
| 987 return isolate->heap()->undefined_value(); | 987 return isolate->heap()->undefined_value(); |
| 988 } | 988 } |
| 989 | 989 |
| 990 } // namespace internal | 990 } // namespace internal |
| 991 } // namespace v8 | 991 } // namespace v8 |
| OLD | NEW |