| 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 <iomanip> | 5 #include <iomanip> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object); | 74 if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object); |
| 75 Handle<JSFunction> constructor; | 75 Handle<JSFunction> constructor; |
| 76 if (object->IsNumber()) { | 76 if (object->IsNumber()) { |
| 77 constructor = handle(native_context->number_function(), isolate); | 77 constructor = handle(native_context->number_function(), isolate); |
| 78 } else if (object->IsBoolean()) { | 78 } else if (object->IsBoolean()) { |
| 79 constructor = handle(native_context->boolean_function(), isolate); | 79 constructor = handle(native_context->boolean_function(), isolate); |
| 80 } else if (object->IsString()) { | 80 } else if (object->IsString()) { |
| 81 constructor = handle(native_context->string_function(), isolate); | 81 constructor = handle(native_context->string_function(), isolate); |
| 82 } else if (object->IsSymbol()) { | 82 } else if (object->IsSymbol()) { |
| 83 constructor = handle(native_context->symbol_function(), isolate); | 83 constructor = handle(native_context->symbol_function(), isolate); |
| 84 } else if (object->IsFloat32x4()) { |
| 85 constructor = handle(native_context->float32x4_function(), isolate); |
| 84 } else { | 86 } else { |
| 85 return MaybeHandle<JSReceiver>(); | 87 return MaybeHandle<JSReceiver>(); |
| 86 } | 88 } |
| 87 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor); | 89 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor); |
| 88 Handle<JSValue>::cast(result)->set_value(*object); | 90 Handle<JSValue>::cast(result)->set_value(*object); |
| 89 return result; | 91 return result; |
| 90 } | 92 } |
| 91 | 93 |
| 92 | 94 |
| 93 bool Object::BooleanValue() { | 95 bool Object::BooleanValue() { |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 | 603 |
| 602 Map* Object::GetRootMap(Isolate* isolate) { | 604 Map* Object::GetRootMap(Isolate* isolate) { |
| 603 DisallowHeapAllocation no_alloc; | 605 DisallowHeapAllocation no_alloc; |
| 604 if (IsSmi()) { | 606 if (IsSmi()) { |
| 605 Context* context = isolate->context()->native_context(); | 607 Context* context = isolate->context()->native_context(); |
| 606 return context->number_function()->initial_map(); | 608 return context->number_function()->initial_map(); |
| 607 } | 609 } |
| 608 | 610 |
| 609 HeapObject* heap_object = HeapObject::cast(this); | 611 HeapObject* heap_object = HeapObject::cast(this); |
| 610 | 612 |
| 611 // The object is either a number, a string, a boolean, | 613 // The object is either a number, a string, a symbol, a boolean, a SIMD value, |
| 612 // a real JS object, or a Harmony proxy. | 614 // a real JS object, or a Harmony proxy. |
| 613 if (heap_object->IsJSReceiver()) { | 615 if (heap_object->IsJSReceiver()) { |
| 614 return heap_object->map(); | 616 return heap_object->map(); |
| 615 } | 617 } |
| 616 Context* context = isolate->context()->native_context(); | 618 Context* context = isolate->context()->native_context(); |
| 617 | 619 |
| 618 if (heap_object->IsHeapNumber()) { | 620 if (heap_object->IsHeapNumber()) { |
| 619 return context->number_function()->initial_map(); | 621 return context->number_function()->initial_map(); |
| 620 } | 622 } |
| 621 if (heap_object->IsString()) { | 623 if (heap_object->IsString()) { |
| 622 return context->string_function()->initial_map(); | 624 return context->string_function()->initial_map(); |
| 623 } | 625 } |
| 624 if (heap_object->IsSymbol()) { | 626 if (heap_object->IsSymbol()) { |
| 625 return context->symbol_function()->initial_map(); | 627 return context->symbol_function()->initial_map(); |
| 626 } | 628 } |
| 627 if (heap_object->IsBoolean()) { | 629 if (heap_object->IsBoolean()) { |
| 628 return context->boolean_function()->initial_map(); | 630 return context->boolean_function()->initial_map(); |
| 629 } | 631 } |
| 632 if (heap_object->IsFloat32x4()) { |
| 633 return context->float32x4_function()->initial_map(); |
| 634 } |
| 630 return isolate->heap()->null_value()->map(); | 635 return isolate->heap()->null_value()->map(); |
| 631 } | 636 } |
| 632 | 637 |
| 633 | 638 |
| 634 Object* Object::GetHash() { | 639 Object* Object::GetHash() { |
| 635 Object* hash = GetSimpleHash(); | 640 Object* hash = GetSimpleHash(); |
| 636 if (hash->IsSmi()) return hash; | 641 if (hash->IsSmi()) return hash; |
| 637 | 642 |
| 638 DCHECK(IsJSReceiver()); | 643 DCHECK(IsJSReceiver()); |
| 639 return JSReceiver::cast(this)->GetIdentityHash(); | 644 return JSReceiver::cast(this)->GetIdentityHash(); |
| (...skipping 15549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16189 Handle<Object> new_value) { | 16194 Handle<Object> new_value) { |
| 16190 if (cell->value() != *new_value) { | 16195 if (cell->value() != *new_value) { |
| 16191 cell->set_value(*new_value); | 16196 cell->set_value(*new_value); |
| 16192 Isolate* isolate = cell->GetIsolate(); | 16197 Isolate* isolate = cell->GetIsolate(); |
| 16193 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16198 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 16194 isolate, DependentCode::kPropertyCellChangedGroup); | 16199 isolate, DependentCode::kPropertyCellChangedGroup); |
| 16195 } | 16200 } |
| 16196 } | 16201 } |
| 16197 } // namespace internal | 16202 } // namespace internal |
| 16198 } // namespace v8 | 16203 } // namespace v8 |
| OLD | NEW |