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 } | |
1887 case JS_WEAK_MAP_TYPE: { | 1871 case JS_WEAK_MAP_TYPE: { |
1888 accumulator->Add("<JS WeakMap>"); | 1872 accumulator->Add("<JS WeakMap>"); |
1889 break; | 1873 break; |
1890 } | 1874 } |
1891 case JS_WEAK_SET_TYPE: { | 1875 case JS_WEAK_SET_TYPE: { |
1892 accumulator->Add("<JS WeakSet>"); | 1876 accumulator->Add("<JS WeakSet>"); |
1893 break; | 1877 break; |
1894 } | 1878 } |
1895 case JS_REGEXP_TYPE: { | 1879 case JS_REGEXP_TYPE: { |
1896 accumulator->Add("<JS RegExp>"); | 1880 accumulator->Add("<JS RegExp>"); |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2400 return hash; | 2384 return hash; |
2401 } | 2385 } |
2402 | 2386 |
2403 | 2387 |
2404 void Simd128Value::CopyBits(void* destination) const { | 2388 void Simd128Value::CopyBits(void* destination) const { |
2405 memcpy(destination, &READ_BYTE_FIELD(this, kValueOffset), kSimd128Size); | 2389 memcpy(destination, &READ_BYTE_FIELD(this, kValueOffset), kSimd128Size); |
2406 } | 2390 } |
2407 | 2391 |
2408 | 2392 |
2409 String* JSReceiver::class_name() { | 2393 String* JSReceiver::class_name() { |
2410 if (IsFunction()) { | 2394 if (IsJSFunction()) { |
2411 return GetHeap()->Function_string(); | 2395 return GetHeap()->Function_string(); |
2412 } | 2396 } |
2413 Object* maybe_constructor = map()->GetConstructor(); | 2397 Object* maybe_constructor = map()->GetConstructor(); |
2414 if (maybe_constructor->IsJSFunction()) { | 2398 if (maybe_constructor->IsJSFunction()) { |
2415 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 2399 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
2416 return String::cast(constructor->shared()->instance_class_name()); | 2400 return String::cast(constructor->shared()->instance_class_name()); |
2417 } | 2401 } |
2418 // If the constructor is not present, return "Object". | 2402 // If the constructor is not present, return "Object". |
2419 return GetHeap()->Object_string(); | 2403 return GetHeap()->Object_string(); |
2420 } | 2404 } |
2421 | 2405 |
2422 | 2406 |
2423 MaybeHandle<String> JSReceiver::BuiltinStringTag(Handle<JSReceiver> object) { | 2407 MaybeHandle<String> JSReceiver::BuiltinStringTag(Handle<JSReceiver> object) { |
2424 Maybe<bool> is_array = Object::IsArray(object); | 2408 Maybe<bool> is_array = Object::IsArray(object); |
2425 MAYBE_RETURN(is_array, MaybeHandle<String>()); | 2409 MAYBE_RETURN(is_array, MaybeHandle<String>()); |
2426 Isolate* const isolate = object->GetIsolate(); | |
2427 if (is_array.FromJust()) { | 2410 if (is_array.FromJust()) { |
2428 return isolate->factory()->Array_string(); | 2411 return object->GetIsolate()->factory()->Array_string(); |
2429 } | 2412 } |
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 // } | |
2436 // TODO(adamk): class_name() is expensive, replace with instance type | 2413 // TODO(adamk): class_name() is expensive, replace with instance type |
2437 // checks where possible. | 2414 // checks where possible. |
2438 return handle(object->class_name(), isolate); | 2415 return handle(object->class_name()); |
2439 } | 2416 } |
2440 | 2417 |
2441 | 2418 |
2442 // static | 2419 // static |
2443 Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) { | 2420 Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) { |
2444 Isolate* isolate = receiver->GetIsolate(); | 2421 Isolate* isolate = receiver->GetIsolate(); |
2445 | 2422 |
2446 // If the object was instantiated simply with base == new.target, the | 2423 // If the object was instantiated simply with base == new.target, the |
2447 // constructor on the map provides the most accurate name. | 2424 // constructor on the map provides the most accurate name. |
2448 // Don't provide the info for prototypes, since their constructors are | 2425 // Don't provide the info for prototypes, since their constructors are |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2481 if (name->length() > 0) result = handle(name, isolate); | 2458 if (name->length() > 0) result = handle(name, isolate); |
2482 } | 2459 } |
2483 | 2460 |
2484 return result.is_identical_to(isolate->factory()->Object_string()) | 2461 return result.is_identical_to(isolate->factory()->Object_string()) |
2485 ? handle(receiver->class_name()) | 2462 ? handle(receiver->class_name()) |
2486 : result; | 2463 : result; |
2487 } | 2464 } |
2488 | 2465 |
2489 | 2466 |
2490 Context* JSReceiver::GetCreationContext() { | 2467 Context* JSReceiver::GetCreationContext() { |
2491 if (IsJSBoundFunction()) { | |
2492 return JSBoundFunction::cast(this)->creation_context(); | |
2493 } | |
2494 Object* constructor = map()->GetConstructor(); | 2468 Object* constructor = map()->GetConstructor(); |
2495 JSFunction* function; | 2469 JSFunction* function; |
2496 if (constructor->IsJSFunction()) { | 2470 if (!constructor->IsJSFunction()) { |
2497 function = JSFunction::cast(constructor); | |
2498 } else { | |
2499 // Functions have null as a constructor, | 2471 // Functions have null as a constructor, |
2500 // but any JSFunction knows its context immediately. | 2472 // but any JSFunction knows its context immediately. |
2501 CHECK(IsJSFunction()); | |
2502 function = JSFunction::cast(this); | 2473 function = JSFunction::cast(this); |
| 2474 } else { |
| 2475 function = JSFunction::cast(constructor); |
2503 } | 2476 } |
2504 | 2477 |
2505 return function->context()->native_context(); | 2478 return function->context()->native_context(); |
2506 } | 2479 } |
2507 | 2480 |
2508 | 2481 |
2509 static Handle<Object> WrapType(Handle<HeapType> type) { | 2482 static Handle<Object> WrapType(Handle<HeapType> type) { |
2510 if (type->IsClass()) return Map::WeakCellForMap(type->AsClass()->Map()); | 2483 if (type->IsClass()) return Map::WeakCellForMap(type->AsClass()->Map()); |
2511 return type; | 2484 return type; |
2512 } | 2485 } |
(...skipping 2456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4969 if (proxy->IsRevoked()) { | 4942 if (proxy->IsRevoked()) { |
4970 THROW_NEW_ERROR(proxy->GetIsolate(), | 4943 THROW_NEW_ERROR(proxy->GetIsolate(), |
4971 NewTypeError(MessageTemplate::kProxyRevoked), Context); | 4944 NewTypeError(MessageTemplate::kProxyRevoked), Context); |
4972 } | 4945 } |
4973 Handle<JSReceiver> target(JSReceiver::cast(proxy->target())); | 4946 Handle<JSReceiver> target(JSReceiver::cast(proxy->target())); |
4974 return JSReceiver::GetFunctionRealm(target); | 4947 return JSReceiver::GetFunctionRealm(target); |
4975 } | 4948 } |
4976 | 4949 |
4977 | 4950 |
4978 // static | 4951 // 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 | |
4988 Handle<Context> JSFunction::GetFunctionRealm(Handle<JSFunction> function) { | 4952 Handle<Context> JSFunction::GetFunctionRealm(Handle<JSFunction> function) { |
4989 DCHECK(function->map()->is_constructor()); | 4953 DCHECK(function->map()->is_constructor()); |
4990 return handle(function->context()->native_context()); | 4954 return handle(function->context()->native_context()); |
4991 } | 4955 } |
4992 | 4956 |
4993 | 4957 |
4994 // static | 4958 // static |
4995 MaybeHandle<Context> JSObject::GetFunctionRealm(Handle<JSObject> object) { | 4959 MaybeHandle<Context> JSObject::GetFunctionRealm(Handle<JSObject> object) { |
4996 DCHECK(object->map()->is_constructor()); | 4960 DCHECK(object->map()->is_constructor()); |
4997 DCHECK(!object->IsJSFunction()); | 4961 DCHECK(!object->IsJSFunction()); |
4998 return handle(object->GetCreationContext()); | 4962 return handle(object->GetCreationContext()); |
4999 } | 4963 } |
5000 | 4964 |
5001 | 4965 |
5002 // static | 4966 // static |
5003 MaybeHandle<Context> JSReceiver::GetFunctionRealm(Handle<JSReceiver> receiver) { | 4967 MaybeHandle<Context> JSReceiver::GetFunctionRealm(Handle<JSReceiver> receiver) { |
5004 if (receiver->IsJSProxy()) { | 4968 if (receiver->IsJSProxy()) { |
5005 return JSProxy::GetFunctionRealm(Handle<JSProxy>::cast(receiver)); | 4969 return JSProxy::GetFunctionRealm(Handle<JSProxy>::cast(receiver)); |
5006 } | 4970 } |
5007 | 4971 |
5008 if (receiver->IsJSFunction()) { | 4972 if (receiver->IsJSFunction()) { |
5009 return JSFunction::GetFunctionRealm(Handle<JSFunction>::cast(receiver)); | 4973 return JSFunction::GetFunctionRealm(Handle<JSFunction>::cast(receiver)); |
5010 } | 4974 } |
5011 | 4975 |
5012 if (receiver->IsJSBoundFunction()) { | |
5013 return JSBoundFunction::GetFunctionRealm( | |
5014 Handle<JSBoundFunction>::cast(receiver)); | |
5015 } | |
5016 | |
5017 return JSObject::GetFunctionRealm(Handle<JSObject>::cast(receiver)); | 4976 return JSObject::GetFunctionRealm(Handle<JSObject>::cast(receiver)); |
5018 } | 4977 } |
5019 | 4978 |
5020 | 4979 |
5021 Maybe<PropertyAttributes> JSProxy::GetPropertyAttributes(LookupIterator* it) { | 4980 Maybe<PropertyAttributes> JSProxy::GetPropertyAttributes(LookupIterator* it) { |
5022 Isolate* isolate = it->isolate(); | 4981 Isolate* isolate = it->isolate(); |
5023 HandleScope scope(isolate); | 4982 HandleScope scope(isolate); |
5024 PropertyDescriptor desc; | 4983 PropertyDescriptor desc; |
5025 Maybe<bool> found = JSProxy::GetOwnPropertyDescriptor( | 4984 Maybe<bool> found = JSProxy::GetOwnPropertyDescriptor( |
5026 isolate, it->GetHolder<JSProxy>(), it->GetName(), &desc); | 4985 isolate, it->GetHolder<JSProxy>(), it->GetName(), &desc); |
(...skipping 5753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10780 int number_of_literals, | 10739 int number_of_literals, |
10781 PretenureFlag pretenure) { | 10740 PretenureFlag pretenure) { |
10782 Handle<FixedArray> literals = isolate->factory()->NewFixedArray( | 10741 Handle<FixedArray> literals = isolate->factory()->NewFixedArray( |
10783 number_of_literals + kFirstLiteralIndex, pretenure); | 10742 number_of_literals + kFirstLiteralIndex, pretenure); |
10784 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals); | 10743 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals); |
10785 casted_literals->set_feedback_vector(*vector); | 10744 casted_literals->set_feedback_vector(*vector); |
10786 return casted_literals; | 10745 return casted_literals; |
10787 } | 10746 } |
10788 | 10747 |
10789 | 10748 |
| 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: | |
12853 case JS_PROXY_TYPE: | 12852 case JS_PROXY_TYPE: |
12854 case JS_GLOBAL_PROXY_TYPE: | 12853 case JS_GLOBAL_PROXY_TYPE: |
12855 case JS_GLOBAL_OBJECT_TYPE: | 12854 case JS_GLOBAL_OBJECT_TYPE: |
12856 case FIXED_ARRAY_TYPE: | 12855 case FIXED_ARRAY_TYPE: |
12857 case FIXED_DOUBLE_ARRAY_TYPE: | 12856 case FIXED_DOUBLE_ARRAY_TYPE: |
12858 case ODDBALL_TYPE: | 12857 case ODDBALL_TYPE: |
12859 case FOREIGN_TYPE: | 12858 case FOREIGN_TYPE: |
12860 case MAP_TYPE: | 12859 case MAP_TYPE: |
12861 case CODE_TYPE: | 12860 case CODE_TYPE: |
12862 case CELL_TYPE: | 12861 case CELL_TYPE: |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12987 map->SetConstructor(*constructor); | 12986 map->SetConstructor(*constructor); |
12988 map->StartInobjectSlackTracking(); | 12987 map->StartInobjectSlackTracking(); |
12989 return map; | 12988 return map; |
12990 } | 12989 } |
12991 } | 12990 } |
12992 | 12991 |
12993 // Slow path, new.target is either a proxy or can't cache the map. | 12992 // Slow path, new.target is either a proxy or can't cache the map. |
12994 // new.target.prototype is not guaranteed to be a JSReceiver, and may need to | 12993 // new.target.prototype is not guaranteed to be a JSReceiver, and may need to |
12995 // fall back to the intrinsicDefaultProto. | 12994 // fall back to the intrinsicDefaultProto. |
12996 Handle<Object> prototype; | 12995 Handle<Object> prototype; |
12997 if (new_target->IsJSFunction()) { | 12996 if (new_target->IsJSProxy()) { |
| 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 { |
12998 Handle<JSFunction> function = Handle<JSFunction>::cast(new_target); | 13003 Handle<JSFunction> function = Handle<JSFunction>::cast(new_target); |
12999 // Make sure the new.target.prototype is cached. | 13004 // Make sure the new.target.prototype is cached. |
13000 EnsureHasInitialMap(function); | 13005 EnsureHasInitialMap(function); |
13001 prototype = handle(function->prototype(), isolate); | 13006 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 | |
13127 Handle<String> JSFunction::ToString(Handle<JSFunction> function) { | 13120 Handle<String> JSFunction::ToString(Handle<JSFunction> function) { |
13128 Isolate* const isolate = function->GetIsolate(); | 13121 Isolate* const isolate = function->GetIsolate(); |
13129 Handle<SharedFunctionInfo> shared_info(function->shared(), isolate); | 13122 Handle<SharedFunctionInfo> shared_info(function->shared(), isolate); |
13130 | 13123 |
13131 // Check if {function} should hide its source code. | 13124 // Check if {function} should hide its source code. |
13132 if (!shared_info->script()->IsScript() || | 13125 if (!shared_info->script()->IsScript() || |
13133 Script::cast(shared_info->script())->hide_source()) { | 13126 Script::cast(shared_info->script())->hide_source()) { |
13134 return NativeCodeFunctionSourceString(shared_info); | 13127 return NativeCodeFunctionSourceString(shared_info); |
13135 } | 13128 } |
13136 | 13129 |
(...skipping 6351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19488 if (cell->value() != *new_value) { | 19481 if (cell->value() != *new_value) { |
19489 cell->set_value(*new_value); | 19482 cell->set_value(*new_value); |
19490 Isolate* isolate = cell->GetIsolate(); | 19483 Isolate* isolate = cell->GetIsolate(); |
19491 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19484 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19492 isolate, DependentCode::kPropertyCellChangedGroup); | 19485 isolate, DependentCode::kPropertyCellChangedGroup); |
19493 } | 19486 } |
19494 } | 19487 } |
19495 | 19488 |
19496 } // namespace internal | 19489 } // namespace internal |
19497 } // namespace v8 | 19490 } // namespace v8 |
OLD | NEW |