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 16166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16177 } | 16177 } |
16178 break; | 16178 break; |
16179 } | 16179 } |
16180 } | 16180 } |
16181 | 16181 |
16182 DCHECK(!storage || storage->length() == counter); | 16182 DCHECK(!storage || storage->length() == counter); |
16183 return counter; | 16183 return counter; |
16184 } | 16184 } |
16185 | 16185 |
16186 | 16186 |
| 16187 MaybeHandle<String> JSObject::ObjectProtoToString(Isolate* isolate, |
| 16188 Handle<Object> object) { |
| 16189 if (object->IsUndefined()) return isolate->factory()->undefined_to_string(); |
| 16190 if (object->IsNull()) return isolate->factory()->null_to_string(); |
| 16191 |
| 16192 Handle<JSReceiver> receiver; |
| 16193 CHECK(Object::ToObject(isolate, object).ToHandle(&receiver)); |
| 16194 |
| 16195 Handle<String> tag; |
| 16196 if (FLAG_harmony_tostring) { |
| 16197 Handle<Object> to_string_tag; |
| 16198 ASSIGN_RETURN_ON_EXCEPTION( |
| 16199 isolate, to_string_tag, |
| 16200 GetProperty(receiver, isolate->factory()->to_string_tag_symbol()), |
| 16201 String); |
| 16202 if (to_string_tag->IsString()) { |
| 16203 tag = Handle<String>::cast(to_string_tag); |
| 16204 } |
| 16205 } |
| 16206 |
| 16207 if (tag.is_null()) { |
| 16208 // TODO(adamk): class_name() is expensive, replace with instance type |
| 16209 // checks where possible. |
| 16210 tag = handle(receiver->class_name(), isolate); |
| 16211 } |
| 16212 |
| 16213 IncrementalStringBuilder builder(isolate); |
| 16214 builder.AppendCString("[object "); |
| 16215 builder.AppendString(tag); |
| 16216 builder.AppendCharacter(']'); |
| 16217 return builder.Finish(); |
| 16218 } |
| 16219 |
| 16220 |
16187 const char* Symbol::PrivateSymbolToName() const { | 16221 const char* Symbol::PrivateSymbolToName() const { |
16188 Heap* heap = GetIsolate()->heap(); | 16222 Heap* heap = GetIsolate()->heap(); |
16189 #define SYMBOL_CHECK_AND_PRINT(name) \ | 16223 #define SYMBOL_CHECK_AND_PRINT(name) \ |
16190 if (this == heap->name()) return #name; | 16224 if (this == heap->name()) return #name; |
16191 PRIVATE_SYMBOL_LIST(SYMBOL_CHECK_AND_PRINT) | 16225 PRIVATE_SYMBOL_LIST(SYMBOL_CHECK_AND_PRINT) |
16192 #undef SYMBOL_CHECK_AND_PRINT | 16226 #undef SYMBOL_CHECK_AND_PRINT |
16193 return "UNKNOWN"; | 16227 return "UNKNOWN"; |
16194 } | 16228 } |
16195 | 16229 |
16196 | 16230 |
(...skipping 3028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19225 if (cell->value() != *new_value) { | 19259 if (cell->value() != *new_value) { |
19226 cell->set_value(*new_value); | 19260 cell->set_value(*new_value); |
19227 Isolate* isolate = cell->GetIsolate(); | 19261 Isolate* isolate = cell->GetIsolate(); |
19228 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19262 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19229 isolate, DependentCode::kPropertyCellChangedGroup); | 19263 isolate, DependentCode::kPropertyCellChangedGroup); |
19230 } | 19264 } |
19231 } | 19265 } |
19232 | 19266 |
19233 } // namespace internal | 19267 } // namespace internal |
19234 } // namespace v8 | 19268 } // namespace v8 |
OLD | NEW |