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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 600 |
599 Map* Object::GetRootMap(Isolate* isolate) { | 601 Map* Object::GetRootMap(Isolate* isolate) { |
600 DisallowHeapAllocation no_alloc; | 602 DisallowHeapAllocation no_alloc; |
601 if (IsSmi()) { | 603 if (IsSmi()) { |
602 Context* context = isolate->context()->native_context(); | 604 Context* context = isolate->context()->native_context(); |
603 return context->number_function()->initial_map(); | 605 return context->number_function()->initial_map(); |
604 } | 606 } |
605 | 607 |
606 HeapObject* heap_object = HeapObject::cast(this); | 608 HeapObject* heap_object = HeapObject::cast(this); |
607 | 609 |
608 // The object is either a number, a string, a boolean, | 610 // The object is either a number, a string, a symbol, a boolean, a SIMD value, |
609 // a real JS object, or a Harmony proxy. | 611 // a real JS object, or a Harmony proxy. |
610 if (heap_object->IsJSReceiver()) { | 612 if (heap_object->IsJSReceiver()) { |
611 return heap_object->map(); | 613 return heap_object->map(); |
612 } | 614 } |
613 Context* context = isolate->context()->native_context(); | 615 Context* context = isolate->context()->native_context(); |
614 | 616 |
615 if (heap_object->IsHeapNumber()) { | 617 if (heap_object->IsHeapNumber()) { |
616 return context->number_function()->initial_map(); | 618 return context->number_function()->initial_map(); |
617 } | 619 } |
618 if (heap_object->IsString()) { | 620 if (heap_object->IsString()) { |
619 return context->string_function()->initial_map(); | 621 return context->string_function()->initial_map(); |
620 } | 622 } |
621 if (heap_object->IsSymbol()) { | 623 if (heap_object->IsSymbol()) { |
622 return context->symbol_function()->initial_map(); | 624 return context->symbol_function()->initial_map(); |
623 } | 625 } |
624 if (heap_object->IsBoolean()) { | 626 if (heap_object->IsBoolean()) { |
625 return context->boolean_function()->initial_map(); | 627 return context->boolean_function()->initial_map(); |
626 } | 628 } |
| 629 if (heap_object->IsFloat32x4()) { |
| 630 return context->float32x4_function()->initial_map(); |
| 631 } |
627 return isolate->heap()->null_value()->map(); | 632 return isolate->heap()->null_value()->map(); |
628 } | 633 } |
629 | 634 |
630 | 635 |
631 Object* Object::GetHash() { | 636 Object* Object::GetHash() { |
632 Object* hash = GetSimpleHash(); | 637 Object* hash = GetSimpleHash(); |
633 if (hash->IsSmi()) return hash; | 638 if (hash->IsSmi()) return hash; |
634 | 639 |
635 DCHECK(IsJSReceiver()); | 640 DCHECK(IsJSReceiver()); |
636 return JSReceiver::cast(this)->GetIdentityHash(); | 641 return JSReceiver::cast(this)->GetIdentityHash(); |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 return DoubleToBoolean(value()); | 1523 return DoubleToBoolean(value()); |
1519 } | 1524 } |
1520 | 1525 |
1521 | 1526 |
1522 void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT | 1527 void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT |
1523 os << value(); | 1528 os << value(); |
1524 } | 1529 } |
1525 | 1530 |
1526 | 1531 |
1527 void Float32x4::Float32x4Print(std::ostream& os) { // NOLINT | 1532 void Float32x4::Float32x4Print(std::ostream& os) { // NOLINT |
1528 os << get_lane(0) << ", " << get_lane(1) << ", " << get_lane(2) << ", " | 1533 char arr[100]; |
1529 << get_lane(3); | 1534 Vector<char> buffer(arr, arraysize(arr)); |
| 1535 os << std::string(DoubleToCString(get_lane(0), buffer)) << ", " |
| 1536 << std::string(DoubleToCString(get_lane(1), buffer)) << ", " |
| 1537 << std::string(DoubleToCString(get_lane(2), buffer)) << ", " |
| 1538 << std::string(DoubleToCString(get_lane(3), buffer)); |
1530 } | 1539 } |
1531 | 1540 |
1532 | 1541 |
1533 String* JSReceiver::class_name() { | 1542 String* JSReceiver::class_name() { |
1534 if (IsJSFunction() || IsJSFunctionProxy()) { | 1543 if (IsJSFunction() || IsJSFunctionProxy()) { |
1535 return GetHeap()->Function_string(); | 1544 return GetHeap()->Function_string(); |
1536 } | 1545 } |
1537 Object* maybe_constructor = map()->GetConstructor(); | 1546 Object* maybe_constructor = map()->GetConstructor(); |
1538 if (maybe_constructor->IsJSFunction()) { | 1547 if (maybe_constructor->IsJSFunction()) { |
1539 JSFunction* constructor = JSFunction::cast(maybe_constructor); | 1548 JSFunction* constructor = JSFunction::cast(maybe_constructor); |
(...skipping 14582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16122 Handle<Object> new_value) { | 16131 Handle<Object> new_value) { |
16123 if (cell->value() != *new_value) { | 16132 if (cell->value() != *new_value) { |
16124 cell->set_value(*new_value); | 16133 cell->set_value(*new_value); |
16125 Isolate* isolate = cell->GetIsolate(); | 16134 Isolate* isolate = cell->GetIsolate(); |
16126 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16135 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16127 isolate, DependentCode::kPropertyCellChangedGroup); | 16136 isolate, DependentCode::kPropertyCellChangedGroup); |
16128 } | 16137 } |
16129 } | 16138 } |
16130 } // namespace internal | 16139 } // namespace internal |
16131 } // namespace v8 | 16140 } // namespace v8 |
OLD | NEW |