| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1861 | 1861 |
| 1862 void JSObject::JSObjectShortPrint(StringStream* accumulator) { | 1862 void JSObject::JSObjectShortPrint(StringStream* accumulator) { |
| 1863 switch (map()->instance_type()) { | 1863 switch (map()->instance_type()) { |
| 1864 case JS_ARRAY_TYPE: { | 1864 case JS_ARRAY_TYPE: { |
| 1865 double length = JSArray::cast(this)->length()->IsUndefined() | 1865 double length = JSArray::cast(this)->length()->IsUndefined() |
| 1866 ? 0 | 1866 ? 0 |
| 1867 : JSArray::cast(this)->length()->Number(); | 1867 : JSArray::cast(this)->length()->Number(); |
| 1868 accumulator->Add("<JS Array[%u]>", static_cast<uint32_t>(length)); | 1868 accumulator->Add("<JS Array[%u]>", static_cast<uint32_t>(length)); |
| 1869 break; | 1869 break; |
| 1870 } | 1870 } |
| 1871 case JS_BOUND_FUNCTION_TYPE: { |
| 1872 JSBoundFunction* bound_function = JSBoundFunction::cast(this); |
| 1873 Object* name = bound_function->name(); |
| 1874 accumulator->Add("<JS BoundFunction"); |
| 1875 if (name->IsString()) { |
| 1876 String* str = String::cast(name); |
| 1877 if (str->length() > 0) { |
| 1878 accumulator->Add(" "); |
| 1879 accumulator->Put(str); |
| 1880 } |
| 1881 } |
| 1882 accumulator->Add( |
| 1883 " (BoundTargetFunction %p)>", |
| 1884 reinterpret_cast<void*>(bound_function->bound_target_function())); |
| 1885 break; |
| 1886 } |
| 1871 case JS_WEAK_MAP_TYPE: { | 1887 case JS_WEAK_MAP_TYPE: { |
| 1872 accumulator->Add("<JS WeakMap>"); | 1888 accumulator->Add("<JS WeakMap>"); |
| 1873 break; | 1889 break; |
| 1874 } | 1890 } |
| 1875 case JS_WEAK_SET_TYPE: { | 1891 case JS_WEAK_SET_TYPE: { |
| 1876 accumulator->Add("<JS WeakSet>"); | 1892 accumulator->Add("<JS WeakSet>"); |
| 1877 break; | 1893 break; |
| 1878 } | 1894 } |
| 1879 case JS_REGEXP_TYPE: { | 1895 case JS_REGEXP_TYPE: { |
| 1880 accumulator->Add("<JS RegExp>"); | 1896 accumulator->Add("<JS RegExp>"); |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2384 return hash; | 2400 return hash; |
| 2385 } | 2401 } |
| 2386 | 2402 |
| 2387 | 2403 |
| 2388 void Simd128Value::CopyBits(void* destination) const { | 2404 void Simd128Value::CopyBits(void* destination) const { |
| 2389 memcpy(destination, &READ_BYTE_FIELD(this, kValueOffset), kSimd128Size); | 2405 memcpy(destination, &READ_BYTE_FIELD(this, kValueOffset), kSimd128Size); |
| 2390 } | 2406 } |
| 2391 | 2407 |
| 2392 | 2408 |
| 2393 String* JSReceiver::class_name() { | 2409 String* JSReceiver::class_name() { |
| 2394 if (IsJSFunction()) { | 2410 if (IsFunction()) { |
| 2395 return GetHeap()->Function_string(); | 2411 return GetHeap()->Function_string(); |
| 2396 } | 2412 } |
| 2397 Object* maybe_constructor = map()->GetConstructor(); | 2413 Object* maybe_constructor = map()->GetConstructor(); |
| 2398 if (maybe_constructor->IsJSFunction()) { | 2414 if (maybe_constructor->IsJSFunction()) { |
| 2399 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 2415 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
| 2400 return String::cast(constructor->shared()->instance_class_name()); | 2416 return String::cast(constructor->shared()->instance_class_name()); |
| 2401 } | 2417 } |
| 2402 // If the constructor is not present, return "Object". | 2418 // If the constructor is not present, return "Object". |
| 2403 return GetHeap()->Object_string(); | 2419 return GetHeap()->Object_string(); |
| 2404 } | 2420 } |
| 2405 | 2421 |
| 2406 | 2422 |
| 2407 MaybeHandle<String> JSReceiver::BuiltinStringTag(Handle<JSReceiver> object) { | 2423 MaybeHandle<String> JSReceiver::BuiltinStringTag(Handle<JSReceiver> object) { |
| 2408 Maybe<bool> is_array = Object::IsArray(object); | 2424 Maybe<bool> is_array = Object::IsArray(object); |
| 2409 MAYBE_RETURN(is_array, MaybeHandle<String>()); | 2425 MAYBE_RETURN(is_array, MaybeHandle<String>()); |
| 2426 Isolate* const isolate = object->GetIsolate(); |
| 2410 if (is_array.FromJust()) { | 2427 if (is_array.FromJust()) { |
| 2411 return object->GetIsolate()->factory()->Array_string(); | 2428 return isolate->factory()->Array_string(); |
| 2412 } | 2429 } |
| 2430 // TODO(adamk): According to ES2015, we should return "Function" when |
| 2431 // object has a [[Call]] internal method (corresponds to IsCallable). |
| 2432 // But this is well cemented in layout tests and might cause webbreakage. |
| 2433 // if (object->IsCallable()) { |
| 2434 // return isolate->factory()->Function_string(); |
| 2435 // } |
| 2413 // TODO(adamk): class_name() is expensive, replace with instance type | 2436 // TODO(adamk): class_name() is expensive, replace with instance type |
| 2414 // checks where possible. | 2437 // checks where possible. |
| 2415 return handle(object->class_name()); | 2438 return handle(object->class_name(), isolate); |
| 2416 } | 2439 } |
| 2417 | 2440 |
| 2418 | 2441 |
| 2419 // static | 2442 // static |
| 2420 Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) { | 2443 Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) { |
| 2421 Isolate* isolate = receiver->GetIsolate(); | 2444 Isolate* isolate = receiver->GetIsolate(); |
| 2422 | 2445 |
| 2423 // If the object was instantiated simply with base == new.target, the | 2446 // If the object was instantiated simply with base == new.target, the |
| 2424 // constructor on the map provides the most accurate name. | 2447 // constructor on the map provides the most accurate name. |
| 2425 // Don't provide the info for prototypes, since their constructors are | 2448 // Don't provide the info for prototypes, since their constructors are |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2458 if (name->length() > 0) result = handle(name, isolate); | 2481 if (name->length() > 0) result = handle(name, isolate); |
| 2459 } | 2482 } |
| 2460 | 2483 |
| 2461 return result.is_identical_to(isolate->factory()->Object_string()) | 2484 return result.is_identical_to(isolate->factory()->Object_string()) |
| 2462 ? handle(receiver->class_name()) | 2485 ? handle(receiver->class_name()) |
| 2463 : result; | 2486 : result; |
| 2464 } | 2487 } |
| 2465 | 2488 |
| 2466 | 2489 |
| 2467 Context* JSReceiver::GetCreationContext() { | 2490 Context* JSReceiver::GetCreationContext() { |
| 2491 if (IsJSBoundFunction()) { |
| 2492 return JSBoundFunction::cast(this)->creation_context(); |
| 2493 } |
| 2468 Object* constructor = map()->GetConstructor(); | 2494 Object* constructor = map()->GetConstructor(); |
| 2469 JSFunction* function; | 2495 JSFunction* function; |
| 2470 if (!constructor->IsJSFunction()) { | 2496 if (constructor->IsJSFunction()) { |
| 2497 function = JSFunction::cast(constructor); |
| 2498 } else { |
| 2471 // Functions have null as a constructor, | 2499 // Functions have null as a constructor, |
| 2472 // but any JSFunction knows its context immediately. | 2500 // but any JSFunction knows its context immediately. |
| 2501 CHECK(IsJSFunction()); |
| 2473 function = JSFunction::cast(this); | 2502 function = JSFunction::cast(this); |
| 2474 } else { | |
| 2475 function = JSFunction::cast(constructor); | |
| 2476 } | 2503 } |
| 2477 | 2504 |
| 2478 return function->context()->native_context(); | 2505 return function->context()->native_context(); |
| 2479 } | 2506 } |
| 2480 | 2507 |
| 2481 | 2508 |
| 2482 static Handle<Object> WrapType(Handle<HeapType> type) { | 2509 static Handle<Object> WrapType(Handle<HeapType> type) { |
| 2483 if (type->IsClass()) return Map::WeakCellForMap(type->AsClass()->Map()); | 2510 if (type->IsClass()) return Map::WeakCellForMap(type->AsClass()->Map()); |
| 2484 return type; | 2511 return type; |
| 2485 } | 2512 } |
| (...skipping 2456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4942 if (proxy->IsRevoked()) { | 4969 if (proxy->IsRevoked()) { |
| 4943 THROW_NEW_ERROR(proxy->GetIsolate(), | 4970 THROW_NEW_ERROR(proxy->GetIsolate(), |
| 4944 NewTypeError(MessageTemplate::kProxyRevoked), Context); | 4971 NewTypeError(MessageTemplate::kProxyRevoked), Context); |
| 4945 } | 4972 } |
| 4946 Handle<JSReceiver> target(JSReceiver::cast(proxy->target())); | 4973 Handle<JSReceiver> target(JSReceiver::cast(proxy->target())); |
| 4947 return JSReceiver::GetFunctionRealm(target); | 4974 return JSReceiver::GetFunctionRealm(target); |
| 4948 } | 4975 } |
| 4949 | 4976 |
| 4950 | 4977 |
| 4951 // static | 4978 // static |
| 4979 MaybeHandle<Context> JSBoundFunction::GetFunctionRealm( |
| 4980 Handle<JSBoundFunction> function) { |
| 4981 DCHECK(function->map()->is_constructor()); |
| 4982 return JSReceiver::GetFunctionRealm( |
| 4983 handle(function->bound_target_function())); |
| 4984 } |
| 4985 |
| 4986 |
| 4987 // static |
| 4952 Handle<Context> JSFunction::GetFunctionRealm(Handle<JSFunction> function) { | 4988 Handle<Context> JSFunction::GetFunctionRealm(Handle<JSFunction> function) { |
| 4953 DCHECK(function->map()->is_constructor()); | 4989 DCHECK(function->map()->is_constructor()); |
| 4954 return handle(function->context()->native_context()); | 4990 return handle(function->context()->native_context()); |
| 4955 } | 4991 } |
| 4956 | 4992 |
| 4957 | 4993 |
| 4958 // static | 4994 // static |
| 4959 MaybeHandle<Context> JSObject::GetFunctionRealm(Handle<JSObject> object) { | 4995 MaybeHandle<Context> JSObject::GetFunctionRealm(Handle<JSObject> object) { |
| 4960 DCHECK(object->map()->is_constructor()); | 4996 DCHECK(object->map()->is_constructor()); |
| 4961 DCHECK(!object->IsJSFunction()); | 4997 DCHECK(!object->IsJSFunction()); |
| 4962 return handle(object->GetCreationContext()); | 4998 return handle(object->GetCreationContext()); |
| 4963 } | 4999 } |
| 4964 | 5000 |
| 4965 | 5001 |
| 4966 // static | 5002 // static |
| 4967 MaybeHandle<Context> JSReceiver::GetFunctionRealm(Handle<JSReceiver> receiver) { | 5003 MaybeHandle<Context> JSReceiver::GetFunctionRealm(Handle<JSReceiver> receiver) { |
| 4968 if (receiver->IsJSProxy()) { | 5004 if (receiver->IsJSProxy()) { |
| 4969 return JSProxy::GetFunctionRealm(Handle<JSProxy>::cast(receiver)); | 5005 return JSProxy::GetFunctionRealm(Handle<JSProxy>::cast(receiver)); |
| 4970 } | 5006 } |
| 4971 | 5007 |
| 4972 if (receiver->IsJSFunction()) { | 5008 if (receiver->IsJSFunction()) { |
| 4973 return JSFunction::GetFunctionRealm(Handle<JSFunction>::cast(receiver)); | 5009 return JSFunction::GetFunctionRealm(Handle<JSFunction>::cast(receiver)); |
| 4974 } | 5010 } |
| 4975 | 5011 |
| 5012 if (receiver->IsJSBoundFunction()) { |
| 5013 return JSBoundFunction::GetFunctionRealm( |
| 5014 Handle<JSBoundFunction>::cast(receiver)); |
| 5015 } |
| 5016 |
| 4976 return JSObject::GetFunctionRealm(Handle<JSObject>::cast(receiver)); | 5017 return JSObject::GetFunctionRealm(Handle<JSObject>::cast(receiver)); |
| 4977 } | 5018 } |
| 4978 | 5019 |
| 4979 | 5020 |
| 4980 Maybe<PropertyAttributes> JSProxy::GetPropertyAttributes(LookupIterator* it) { | 5021 Maybe<PropertyAttributes> JSProxy::GetPropertyAttributes(LookupIterator* it) { |
| 4981 Isolate* isolate = it->isolate(); | 5022 Isolate* isolate = it->isolate(); |
| 4982 HandleScope scope(isolate); | 5023 HandleScope scope(isolate); |
| 4983 PropertyDescriptor desc; | 5024 PropertyDescriptor desc; |
| 4984 Maybe<bool> found = JSProxy::GetOwnPropertyDescriptor( | 5025 Maybe<bool> found = JSProxy::GetOwnPropertyDescriptor( |
| 4985 isolate, it->GetHolder<JSProxy>(), it->GetName(), &desc); | 5026 isolate, it->GetHolder<JSProxy>(), it->GetName(), &desc); |
| (...skipping 5753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10739 int number_of_literals, | 10780 int number_of_literals, |
| 10740 PretenureFlag pretenure) { | 10781 PretenureFlag pretenure) { |
| 10741 Handle<FixedArray> literals = isolate->factory()->NewFixedArray( | 10782 Handle<FixedArray> literals = isolate->factory()->NewFixedArray( |
| 10742 number_of_literals + kFirstLiteralIndex, pretenure); | 10783 number_of_literals + kFirstLiteralIndex, pretenure); |
| 10743 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals); | 10784 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals); |
| 10744 casted_literals->set_feedback_vector(*vector); | 10785 casted_literals->set_feedback_vector(*vector); |
| 10745 return casted_literals; | 10786 return casted_literals; |
| 10746 } | 10787 } |
| 10747 | 10788 |
| 10748 | 10789 |
| 10749 // static | |
| 10750 Handle<BindingsArray> BindingsArray::New(Isolate* isolate, | |
| 10751 Handle<TypeFeedbackVector> vector, | |
| 10752 Handle<JSReceiver> bound_function, | |
| 10753 Handle<Object> bound_this, | |
| 10754 int number_of_bindings) { | |
| 10755 Handle<FixedArray> bindings = isolate->factory()->NewFixedArray( | |
| 10756 number_of_bindings + kFirstBindingIndex); | |
| 10757 Handle<BindingsArray> casted_bindings = Handle<BindingsArray>::cast(bindings); | |
| 10758 casted_bindings->set_feedback_vector(*vector); | |
| 10759 casted_bindings->set_bound_function(*bound_function); | |
| 10760 casted_bindings->set_bound_this(*bound_this); | |
| 10761 return casted_bindings; | |
| 10762 } | |
| 10763 | |
| 10764 | |
| 10765 // static | |
| 10766 Handle<JSArray> BindingsArray::CreateBoundArguments( | |
| 10767 Handle<BindingsArray> bindings) { | |
| 10768 int bound_argument_count = bindings->bindings_count(); | |
| 10769 Factory* factory = bindings->GetIsolate()->factory(); | |
| 10770 Handle<FixedArray> arguments = factory->NewFixedArray(bound_argument_count); | |
| 10771 bindings->CopyTo(kFirstBindingIndex, *arguments, 0, bound_argument_count); | |
| 10772 return factory->NewJSArrayWithElements(arguments); | |
| 10773 } | |
| 10774 | |
| 10775 | |
| 10776 // static | |
| 10777 Handle<JSArray> BindingsArray::CreateRuntimeBindings( | |
| 10778 Handle<BindingsArray> bindings) { | |
| 10779 Factory* factory = bindings->GetIsolate()->factory(); | |
| 10780 // A runtime bindings array consists of | |
| 10781 // [bound function, bound this, [arg0, arg1, ...]]. | |
| 10782 Handle<FixedArray> runtime_bindings = | |
| 10783 factory->NewFixedArray(2 + bindings->bindings_count()); | |
| 10784 bindings->CopyTo(kBoundFunctionIndex, *runtime_bindings, 0, | |
| 10785 2 + bindings->bindings_count()); | |
| 10786 return factory->NewJSArrayWithElements(runtime_bindings); | |
| 10787 } | |
| 10788 | |
| 10789 | |
| 10790 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out, | 10790 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out, |
| 10791 CatchPrediction* prediction_out) { | 10791 CatchPrediction* prediction_out) { |
| 10792 int innermost_handler = -1, innermost_start = -1; | 10792 int innermost_handler = -1, innermost_start = -1; |
| 10793 for (int i = 0; i < length(); i += kRangeEntrySize) { | 10793 for (int i = 0; i < length(); i += kRangeEntrySize) { |
| 10794 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); | 10794 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); |
| 10795 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); | 10795 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); |
| 10796 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); | 10796 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); |
| 10797 int handler_offset = HandlerOffsetField::decode(handler_field); | 10797 int handler_offset = HandlerOffsetField::decode(handler_field); |
| 10798 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); | 10798 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); |
| 10799 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value(); | 10799 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value(); |
| (...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12842 case JS_SET_ITERATOR_TYPE: | 12842 case JS_SET_ITERATOR_TYPE: |
| 12843 case JS_MAP_ITERATOR_TYPE: | 12843 case JS_MAP_ITERATOR_TYPE: |
| 12844 case JS_ITERATOR_RESULT_TYPE: | 12844 case JS_ITERATOR_RESULT_TYPE: |
| 12845 case JS_WEAK_MAP_TYPE: | 12845 case JS_WEAK_MAP_TYPE: |
| 12846 case JS_WEAK_SET_TYPE: | 12846 case JS_WEAK_SET_TYPE: |
| 12847 case JS_PROMISE_TYPE: | 12847 case JS_PROMISE_TYPE: |
| 12848 case JS_REGEXP_TYPE: | 12848 case JS_REGEXP_TYPE: |
| 12849 case JS_FUNCTION_TYPE: | 12849 case JS_FUNCTION_TYPE: |
| 12850 return true; | 12850 return true; |
| 12851 | 12851 |
| 12852 case JS_BOUND_FUNCTION_TYPE: |
| 12852 case JS_PROXY_TYPE: | 12853 case JS_PROXY_TYPE: |
| 12853 case JS_GLOBAL_PROXY_TYPE: | 12854 case JS_GLOBAL_PROXY_TYPE: |
| 12854 case JS_GLOBAL_OBJECT_TYPE: | 12855 case JS_GLOBAL_OBJECT_TYPE: |
| 12855 case FIXED_ARRAY_TYPE: | 12856 case FIXED_ARRAY_TYPE: |
| 12856 case FIXED_DOUBLE_ARRAY_TYPE: | 12857 case FIXED_DOUBLE_ARRAY_TYPE: |
| 12857 case ODDBALL_TYPE: | 12858 case ODDBALL_TYPE: |
| 12858 case FOREIGN_TYPE: | 12859 case FOREIGN_TYPE: |
| 12859 case MAP_TYPE: | 12860 case MAP_TYPE: |
| 12860 case CODE_TYPE: | 12861 case CODE_TYPE: |
| 12861 case CELL_TYPE: | 12862 case CELL_TYPE: |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12986 map->SetConstructor(*constructor); | 12987 map->SetConstructor(*constructor); |
| 12987 map->StartInobjectSlackTracking(); | 12988 map->StartInobjectSlackTracking(); |
| 12988 return map; | 12989 return map; |
| 12989 } | 12990 } |
| 12990 } | 12991 } |
| 12991 | 12992 |
| 12992 // Slow path, new.target is either a proxy or can't cache the map. | 12993 // Slow path, new.target is either a proxy or can't cache the map. |
| 12993 // new.target.prototype is not guaranteed to be a JSReceiver, and may need to | 12994 // new.target.prototype is not guaranteed to be a JSReceiver, and may need to |
| 12994 // fall back to the intrinsicDefaultProto. | 12995 // fall back to the intrinsicDefaultProto. |
| 12995 Handle<Object> prototype; | 12996 Handle<Object> prototype; |
| 12996 if (new_target->IsJSProxy()) { | 12997 if (new_target->IsJSFunction()) { |
| 12997 Handle<JSProxy> new_target_proxy = Handle<JSProxy>::cast(new_target); | |
| 12998 Handle<String> prototype_string = isolate->factory()->prototype_string(); | |
| 12999 ASSIGN_RETURN_ON_EXCEPTION( | |
| 13000 isolate, prototype, | |
| 13001 JSReceiver::GetProperty(new_target_proxy, prototype_string), Map); | |
| 13002 } else { | |
| 13003 Handle<JSFunction> function = Handle<JSFunction>::cast(new_target); | 12998 Handle<JSFunction> function = Handle<JSFunction>::cast(new_target); |
| 13004 // Make sure the new.target.prototype is cached. | 12999 // Make sure the new.target.prototype is cached. |
| 13005 EnsureHasInitialMap(function); | 13000 EnsureHasInitialMap(function); |
| 13006 prototype = handle(function->prototype(), isolate); | 13001 prototype = handle(function->prototype(), isolate); |
| 13002 } else { |
| 13003 Handle<String> prototype_string = isolate->factory()->prototype_string(); |
| 13004 ASSIGN_RETURN_ON_EXCEPTION( |
| 13005 isolate, prototype, |
| 13006 JSReceiver::GetProperty(new_target, prototype_string), Map); |
| 13007 } | 13007 } |
| 13008 | 13008 |
| 13009 // If prototype is not a JSReceiver, fetch the intrinsicDefaultProto from the | 13009 // If prototype is not a JSReceiver, fetch the intrinsicDefaultProto from the |
| 13010 // correct realm. Rather than directly fetching the .prototype, we fetch the | 13010 // correct realm. Rather than directly fetching the .prototype, we fetch the |
| 13011 // constructor that points to the .prototype. This relies on | 13011 // constructor that points to the .prototype. This relies on |
| 13012 // constructor.prototype being FROZEN for those constructors. | 13012 // constructor.prototype being FROZEN for those constructors. |
| 13013 if (!prototype->IsJSReceiver()) { | 13013 if (!prototype->IsJSReceiver()) { |
| 13014 Handle<Context> context; | 13014 Handle<Context> context; |
| 13015 ASSIGN_RETURN_ON_EXCEPTION(isolate, context, | 13015 ASSIGN_RETURN_ON_EXCEPTION(isolate, context, |
| 13016 JSReceiver::GetFunctionRealm(new_target), Map); | 13016 JSReceiver::GetFunctionRealm(new_target), Map); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13110 builder.AppendCString("() { [native code] }"); | 13110 builder.AppendCString("() { [native code] }"); |
| 13111 return builder.Finish().ToHandleChecked(); | 13111 return builder.Finish().ToHandleChecked(); |
| 13112 } | 13112 } |
| 13113 return isolate->factory()->NewStringFromAsciiChecked(kNativeCodeSource); | 13113 return isolate->factory()->NewStringFromAsciiChecked(kNativeCodeSource); |
| 13114 } | 13114 } |
| 13115 | 13115 |
| 13116 } // namespace | 13116 } // namespace |
| 13117 | 13117 |
| 13118 | 13118 |
| 13119 // static | 13119 // static |
| 13120 Handle<String> JSBoundFunction::ToString(Handle<JSBoundFunction> function) { |
| 13121 Isolate* const isolate = function->GetIsolate(); |
| 13122 return isolate->factory()->NewStringFromAsciiChecked(kNativeCodeSource); |
| 13123 } |
| 13124 |
| 13125 |
| 13126 // static |
| 13120 Handle<String> JSFunction::ToString(Handle<JSFunction> function) { | 13127 Handle<String> JSFunction::ToString(Handle<JSFunction> function) { |
| 13121 Isolate* const isolate = function->GetIsolate(); | 13128 Isolate* const isolate = function->GetIsolate(); |
| 13122 Handle<SharedFunctionInfo> shared_info(function->shared(), isolate); | 13129 Handle<SharedFunctionInfo> shared_info(function->shared(), isolate); |
| 13123 | 13130 |
| 13124 // Check if {function} should hide its source code. | 13131 // Check if {function} should hide its source code. |
| 13125 if (!shared_info->script()->IsScript() || | 13132 if (!shared_info->script()->IsScript() || |
| 13126 Script::cast(shared_info->script())->hide_source()) { | 13133 Script::cast(shared_info->script())->hide_source()) { |
| 13127 return NativeCodeFunctionSourceString(shared_info); | 13134 return NativeCodeFunctionSourceString(shared_info); |
| 13128 } | 13135 } |
| 13129 | 13136 |
| (...skipping 6351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19481 if (cell->value() != *new_value) { | 19488 if (cell->value() != *new_value) { |
| 19482 cell->set_value(*new_value); | 19489 cell->set_value(*new_value); |
| 19483 Isolate* isolate = cell->GetIsolate(); | 19490 Isolate* isolate = cell->GetIsolate(); |
| 19484 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19491 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19485 isolate, DependentCode::kPropertyCellChangedGroup); | 19492 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19486 } | 19493 } |
| 19487 } | 19494 } |
| 19488 | 19495 |
| 19489 } // namespace internal | 19496 } // namespace internal |
| 19490 } // namespace v8 | 19497 } // namespace v8 |
| OLD | NEW |