OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 break; \ | 2095 break; \ |
2096 } | 2096 } |
2097 SIMD128_TYPES(SIMD128_TYPE) | 2097 SIMD128_TYPES(SIMD128_TYPE) |
2098 #undef SIMD128_TYPE | 2098 #undef SIMD128_TYPE |
2099 UNREACHABLE(); | 2099 UNREACHABLE(); |
2100 break; | 2100 break; |
2101 } | 2101 } |
2102 case JS_PROXY_TYPE: | 2102 case JS_PROXY_TYPE: |
2103 os << "<JSProxy>"; | 2103 os << "<JSProxy>"; |
2104 break; | 2104 break; |
2105 case JS_FUNCTION_PROXY_TYPE: | |
2106 os << "<JSFunctionProxy>"; | |
2107 break; | |
2108 case FOREIGN_TYPE: | 2105 case FOREIGN_TYPE: |
2109 os << "<Foreign>"; | 2106 os << "<Foreign>"; |
2110 break; | 2107 break; |
2111 case CELL_TYPE: { | 2108 case CELL_TYPE: { |
2112 os << "Cell for "; | 2109 os << "Cell for "; |
2113 HeapStringAllocator allocator; | 2110 HeapStringAllocator allocator; |
2114 StringStream accumulator(&allocator); | 2111 StringStream accumulator(&allocator); |
2115 Cell::cast(this)->value()->ShortPrint(&accumulator); | 2112 Cell::cast(this)->value()->ShortPrint(&accumulator); |
2116 os << accumulator.ToCString().get(); | 2113 os << accumulator.ToCString().get(); |
2117 break; | 2114 break; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 return hash; | 2278 return hash; |
2282 } | 2279 } |
2283 | 2280 |
2284 | 2281 |
2285 void Simd128Value::CopyBits(void* destination) const { | 2282 void Simd128Value::CopyBits(void* destination) const { |
2286 memcpy(destination, &READ_BYTE_FIELD(this, kValueOffset), kSimd128Size); | 2283 memcpy(destination, &READ_BYTE_FIELD(this, kValueOffset), kSimd128Size); |
2287 } | 2284 } |
2288 | 2285 |
2289 | 2286 |
2290 String* JSReceiver::class_name() { | 2287 String* JSReceiver::class_name() { |
2291 if (IsJSFunction() || IsJSFunctionProxy()) { | 2288 if (IsJSFunction()) { |
2292 return GetHeap()->Function_string(); | 2289 return GetHeap()->Function_string(); |
2293 } | 2290 } |
2294 Object* maybe_constructor = map()->GetConstructor(); | 2291 Object* maybe_constructor = map()->GetConstructor(); |
2295 if (maybe_constructor->IsJSFunction()) { | 2292 if (maybe_constructor->IsJSFunction()) { |
2296 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 2293 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
2297 return String::cast(constructor->shared()->instance_class_name()); | 2294 return String::cast(constructor->shared()->instance_class_name()); |
2298 } | 2295 } |
2299 // If the constructor is not present, return "Object". | 2296 // If the constructor is not present, return "Object". |
2300 return GetHeap()->Object_string(); | 2297 return GetHeap()->Object_string(); |
2301 } | 2298 } |
(...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4791 } | 4788 } |
4792 | 4789 |
4793 | 4790 |
4794 // static | 4791 // static |
4795 MaybeHandle<Context> JSProxy::GetFunctionRealm(Handle<JSProxy> proxy) { | 4792 MaybeHandle<Context> JSProxy::GetFunctionRealm(Handle<JSProxy> proxy) { |
4796 DCHECK(proxy->map()->is_constructor()); | 4793 DCHECK(proxy->map()->is_constructor()); |
4797 if (proxy->IsRevoked()) { | 4794 if (proxy->IsRevoked()) { |
4798 THROW_NEW_ERROR(proxy->GetIsolate(), | 4795 THROW_NEW_ERROR(proxy->GetIsolate(), |
4799 NewTypeError(MessageTemplate::kProxyRevoked), Context); | 4796 NewTypeError(MessageTemplate::kProxyRevoked), Context); |
4800 } | 4797 } |
4801 | 4798 Handle<JSReceiver> target(JSReceiver::cast(proxy->target())); |
4802 // TODO(verwaest): Get rid of JSFunctionProxies. | 4799 return JSReceiver::GetFunctionRealm(target); |
4803 Object* target = proxy->IsJSFunctionProxy() | |
4804 ? JSFunctionProxy::cast(*proxy)->construct_trap() | |
4805 : proxy->target(); | |
4806 return JSReceiver::GetFunctionRealm(handle(JSReceiver::cast(target))); | |
4807 } | 4800 } |
4808 | 4801 |
4809 | 4802 |
4810 // static | 4803 // static |
4811 MaybeHandle<Context> JSFunction::GetFunctionRealm(Handle<JSFunction> function) { | 4804 MaybeHandle<Context> JSFunction::GetFunctionRealm(Handle<JSFunction> function) { |
4812 DCHECK(function->map()->is_constructor()); | 4805 DCHECK(function->map()->is_constructor()); |
4813 return handle(function->context()->native_context()); | 4806 return handle(function->context()->native_context()); |
4814 } | 4807 } |
4815 | 4808 |
4816 | 4809 |
(...skipping 7698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12515 case JS_SET_ITERATOR_TYPE: | 12508 case JS_SET_ITERATOR_TYPE: |
12516 case JS_MAP_ITERATOR_TYPE: | 12509 case JS_MAP_ITERATOR_TYPE: |
12517 case JS_ITERATOR_RESULT_TYPE: | 12510 case JS_ITERATOR_RESULT_TYPE: |
12518 case JS_WEAK_MAP_TYPE: | 12511 case JS_WEAK_MAP_TYPE: |
12519 case JS_WEAK_SET_TYPE: | 12512 case JS_WEAK_SET_TYPE: |
12520 case JS_PROMISE_TYPE: | 12513 case JS_PROMISE_TYPE: |
12521 case JS_REGEXP_TYPE: | 12514 case JS_REGEXP_TYPE: |
12522 case JS_FUNCTION_TYPE: | 12515 case JS_FUNCTION_TYPE: |
12523 return true; | 12516 return true; |
12524 | 12517 |
12525 case JS_FUNCTION_PROXY_TYPE: | |
12526 case JS_PROXY_TYPE: | 12518 case JS_PROXY_TYPE: |
12527 case JS_GLOBAL_PROXY_TYPE: | 12519 case JS_GLOBAL_PROXY_TYPE: |
12528 case JS_GLOBAL_OBJECT_TYPE: | 12520 case JS_GLOBAL_OBJECT_TYPE: |
12529 case FIXED_ARRAY_TYPE: | 12521 case FIXED_ARRAY_TYPE: |
12530 case FIXED_DOUBLE_ARRAY_TYPE: | 12522 case FIXED_DOUBLE_ARRAY_TYPE: |
12531 case ODDBALL_TYPE: | 12523 case ODDBALL_TYPE: |
12532 case FOREIGN_TYPE: | 12524 case FOREIGN_TYPE: |
12533 case MAP_TYPE: | 12525 case MAP_TYPE: |
12534 case CODE_TYPE: | 12526 case CODE_TYPE: |
12535 case CELL_TYPE: | 12527 case CELL_TYPE: |
(...skipping 6573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19109 if (cell->value() != *new_value) { | 19101 if (cell->value() != *new_value) { |
19110 cell->set_value(*new_value); | 19102 cell->set_value(*new_value); |
19111 Isolate* isolate = cell->GetIsolate(); | 19103 Isolate* isolate = cell->GetIsolate(); |
19112 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19104 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19113 isolate, DependentCode::kPropertyCellChangedGroup); | 19105 isolate, DependentCode::kPropertyCellChangedGroup); |
19114 } | 19106 } |
19115 } | 19107 } |
19116 | 19108 |
19117 } // namespace internal | 19109 } // namespace internal |
19118 } // namespace v8 | 19110 } // namespace v8 |
OLD | NEW |