Chromium Code Reviews| 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 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2071 break; \ | 2071 break; \ |
| 2072 } | 2072 } |
| 2073 SIMD128_TYPES(SIMD128_TYPE) | 2073 SIMD128_TYPES(SIMD128_TYPE) |
| 2074 #undef SIMD128_TYPE | 2074 #undef SIMD128_TYPE |
| 2075 UNREACHABLE(); | 2075 UNREACHABLE(); |
| 2076 break; | 2076 break; |
| 2077 } | 2077 } |
| 2078 case JS_PROXY_TYPE: | 2078 case JS_PROXY_TYPE: |
| 2079 os << "<JSProxy>"; | 2079 os << "<JSProxy>"; |
| 2080 break; | 2080 break; |
| 2081 case JS_FUNCTION_PROXY_TYPE: | |
| 2082 os << "<JSFunctionProxy>"; | |
| 2083 break; | |
| 2084 case FOREIGN_TYPE: | 2081 case FOREIGN_TYPE: |
| 2085 os << "<Foreign>"; | 2082 os << "<Foreign>"; |
| 2086 break; | 2083 break; |
| 2087 case CELL_TYPE: { | 2084 case CELL_TYPE: { |
| 2088 os << "Cell for "; | 2085 os << "Cell for "; |
| 2089 HeapStringAllocator allocator; | 2086 HeapStringAllocator allocator; |
| 2090 StringStream accumulator(&allocator); | 2087 StringStream accumulator(&allocator); |
| 2091 Cell::cast(this)->value()->ShortPrint(&accumulator); | 2088 Cell::cast(this)->value()->ShortPrint(&accumulator); |
| 2092 os << accumulator.ToCString().get(); | 2089 os << accumulator.ToCString().get(); |
| 2093 break; | 2090 break; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2257 return hash; | 2254 return hash; |
| 2258 } | 2255 } |
| 2259 | 2256 |
| 2260 | 2257 |
| 2261 void Simd128Value::CopyBits(void* destination) const { | 2258 void Simd128Value::CopyBits(void* destination) const { |
| 2262 memcpy(destination, &READ_BYTE_FIELD(this, kValueOffset), kSimd128Size); | 2259 memcpy(destination, &READ_BYTE_FIELD(this, kValueOffset), kSimd128Size); |
| 2263 } | 2260 } |
| 2264 | 2261 |
| 2265 | 2262 |
| 2266 String* JSReceiver::class_name() { | 2263 String* JSReceiver::class_name() { |
| 2267 if (IsJSFunction() || IsJSFunctionProxy()) { | 2264 if (IsJSFunction()) { |
| 2268 return GetHeap()->Function_string(); | 2265 return GetHeap()->Function_string(); |
| 2269 } | 2266 } |
| 2270 Object* maybe_constructor = map()->GetConstructor(); | 2267 Object* maybe_constructor = map()->GetConstructor(); |
| 2271 if (maybe_constructor->IsJSFunction()) { | 2268 if (maybe_constructor->IsJSFunction()) { |
| 2272 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 2269 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
| 2273 return String::cast(constructor->shared()->instance_class_name()); | 2270 return String::cast(constructor->shared()->instance_class_name()); |
| 2274 } | 2271 } |
| 2275 // If the constructor is not present, return "Object". | 2272 // If the constructor is not present, return "Object". |
| 2276 return GetHeap()->Object_string(); | 2273 return GetHeap()->Object_string(); |
| 2277 } | 2274 } |
| (...skipping 2473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4751 } | 4748 } |
| 4752 | 4749 |
| 4753 | 4750 |
| 4754 // static | 4751 // static |
| 4755 MaybeHandle<Context> JSProxy::GetFunctionRealm(Handle<JSProxy> proxy) { | 4752 MaybeHandle<Context> JSProxy::GetFunctionRealm(Handle<JSProxy> proxy) { |
| 4756 DCHECK(proxy->map()->is_constructor()); | 4753 DCHECK(proxy->map()->is_constructor()); |
| 4757 if (proxy->IsRevoked()) { | 4754 if (proxy->IsRevoked()) { |
| 4758 THROW_NEW_ERROR(proxy->GetIsolate(), | 4755 THROW_NEW_ERROR(proxy->GetIsolate(), |
| 4759 NewTypeError(MessageTemplate::kProxyRevoked), Context); | 4756 NewTypeError(MessageTemplate::kProxyRevoked), Context); |
| 4760 } | 4757 } |
| 4761 | 4758 // TODO(cbruni): deal with [[Call]] here? |
|
Toon Verwaest
2015/12/03 11:48:42
DCHECK(target->map()->is_callable());
This is guar
Camillo Bruni
2015/12/03 12:18:26
indeed doesn't matter, removed comment.
| |
| 4762 // TODO(verwaest): Get rid of JSFunctionProxies. | 4759 Handle<JSReceiver> target(JSReceiver::cast(proxy->target())); |
| 4763 Object* target = proxy->IsJSFunctionProxy() | 4760 return JSReceiver::GetFunctionRealm(target); |
| 4764 ? JSFunctionProxy::cast(*proxy)->construct_trap() | |
| 4765 : proxy->target(); | |
| 4766 return JSReceiver::GetFunctionRealm(handle(JSReceiver::cast(target))); | |
| 4767 } | 4761 } |
| 4768 | 4762 |
| 4769 | 4763 |
| 4770 // static | 4764 // static |
| 4771 MaybeHandle<Context> JSFunction::GetFunctionRealm(Handle<JSFunction> function) { | 4765 MaybeHandle<Context> JSFunction::GetFunctionRealm(Handle<JSFunction> function) { |
| 4772 DCHECK(function->map()->is_constructor()); | 4766 DCHECK(function->map()->is_constructor()); |
| 4773 return handle(function->context()->native_context()); | 4767 return handle(function->context()->native_context()); |
| 4774 } | 4768 } |
| 4775 | 4769 |
| 4776 | 4770 |
| (...skipping 7696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12473 case JS_SET_ITERATOR_TYPE: | 12467 case JS_SET_ITERATOR_TYPE: |
| 12474 case JS_MAP_ITERATOR_TYPE: | 12468 case JS_MAP_ITERATOR_TYPE: |
| 12475 case JS_ITERATOR_RESULT_TYPE: | 12469 case JS_ITERATOR_RESULT_TYPE: |
| 12476 case JS_WEAK_MAP_TYPE: | 12470 case JS_WEAK_MAP_TYPE: |
| 12477 case JS_WEAK_SET_TYPE: | 12471 case JS_WEAK_SET_TYPE: |
| 12478 case JS_PROMISE_TYPE: | 12472 case JS_PROMISE_TYPE: |
| 12479 case JS_REGEXP_TYPE: | 12473 case JS_REGEXP_TYPE: |
| 12480 case JS_FUNCTION_TYPE: | 12474 case JS_FUNCTION_TYPE: |
| 12481 return true; | 12475 return true; |
| 12482 | 12476 |
| 12483 case JS_FUNCTION_PROXY_TYPE: | |
| 12484 case JS_PROXY_TYPE: | 12477 case JS_PROXY_TYPE: |
| 12485 case JS_GLOBAL_PROXY_TYPE: | 12478 case JS_GLOBAL_PROXY_TYPE: |
| 12486 case JS_GLOBAL_OBJECT_TYPE: | 12479 case JS_GLOBAL_OBJECT_TYPE: |
| 12487 case FIXED_ARRAY_TYPE: | 12480 case FIXED_ARRAY_TYPE: |
| 12488 case FIXED_DOUBLE_ARRAY_TYPE: | 12481 case FIXED_DOUBLE_ARRAY_TYPE: |
| 12489 case ODDBALL_TYPE: | 12482 case ODDBALL_TYPE: |
| 12490 case FOREIGN_TYPE: | 12483 case FOREIGN_TYPE: |
| 12491 case MAP_TYPE: | 12484 case MAP_TYPE: |
| 12492 case CODE_TYPE: | 12485 case CODE_TYPE: |
| 12493 case CELL_TYPE: | 12486 case CELL_TYPE: |
| (...skipping 6575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 19069 if (cell->value() != *new_value) { | 19062 if (cell->value() != *new_value) { |
| 19070 cell->set_value(*new_value); | 19063 cell->set_value(*new_value); |
| 19071 Isolate* isolate = cell->GetIsolate(); | 19064 Isolate* isolate = cell->GetIsolate(); |
| 19072 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19065 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19073 isolate, DependentCode::kPropertyCellChangedGroup); | 19066 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19074 } | 19067 } |
| 19075 } | 19068 } |
| 19076 | 19069 |
| 19077 } // namespace internal | 19070 } // namespace internal |
| 19078 } // namespace v8 | 19071 } // namespace v8 |
| OLD | NEW |