| 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 <iomanip> | 7 #include <iomanip> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 constructor = handle( | 83 constructor = handle( |
| 84 JSFunction::cast(native_context->get(constructor_function_index)), | 84 JSFunction::cast(native_context->get(constructor_function_index)), |
| 85 isolate); | 85 isolate); |
| 86 } | 86 } |
| 87 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor); | 87 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor); |
| 88 Handle<JSValue>::cast(result)->set_value(*object); | 88 Handle<JSValue>::cast(result)->set_value(*object); |
| 89 return result; | 89 return result; |
| 90 } | 90 } |
| 91 | 91 |
| 92 | 92 |
| 93 MaybeHandle<Name> Object::ToName(Isolate* isolate, Handle<Object> object) { |
| 94 if (object->IsName()) { |
| 95 return Handle<Name>::cast(object); |
| 96 } else { |
| 97 Handle<Object> converted; |
| 98 ASSIGN_RETURN_ON_EXCEPTION(isolate, converted, |
| 99 Execution::ToString(isolate, object), Name); |
| 100 return Handle<Name>::cast(converted); |
| 101 } |
| 102 } |
| 103 |
| 104 |
| 93 bool Object::BooleanValue() { | 105 bool Object::BooleanValue() { |
| 94 if (IsBoolean()) return IsTrue(); | 106 if (IsBoolean()) return IsTrue(); |
| 95 if (IsSmi()) return Smi::cast(this)->value() != 0; | 107 if (IsSmi()) return Smi::cast(this)->value() != 0; |
| 96 if (IsUndefined() || IsNull()) return false; | 108 if (IsUndefined() || IsNull()) return false; |
| 97 if (IsUndetectableObject()) return false; // Undetectable object is false. | 109 if (IsUndetectableObject()) return false; // Undetectable object is false. |
| 98 if (IsString()) return String::cast(this)->length() != 0; | 110 if (IsString()) return String::cast(this)->length() != 0; |
| 99 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); | 111 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); |
| 100 if (IsSimd128Value()) return true; // Simd value types evaluate to true. | 112 if (IsSimd128Value()) return true; // Simd value types evaluate to true. |
| 101 return true; | 113 return true; |
| 102 } | 114 } |
| (...skipping 15720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15823 if (cell->value() != *new_value) { | 15835 if (cell->value() != *new_value) { |
| 15824 cell->set_value(*new_value); | 15836 cell->set_value(*new_value); |
| 15825 Isolate* isolate = cell->GetIsolate(); | 15837 Isolate* isolate = cell->GetIsolate(); |
| 15826 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 15838 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 15827 isolate, DependentCode::kPropertyCellChangedGroup); | 15839 isolate, DependentCode::kPropertyCellChangedGroup); |
| 15828 } | 15840 } |
| 15829 } | 15841 } |
| 15830 | 15842 |
| 15831 } // namespace internal | 15843 } // namespace internal |
| 15832 } // namespace v8 | 15844 } // namespace v8 |
| OLD | NEW |