Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: src/objects-printer.cc

Issue 776143005: Optimize Object.seal and Object.preventExtensions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add nonextensible and sealed as special transitions Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/disasm.h" 7 #include "src/disasm.h"
8 #include "src/disassembler.h" 8 #include "src/disassembler.h"
9 #include "src/heap/objects-visiting.h" 9 #include "src/heap/objects-visiting.h"
10 #include "src/jsregexp.h" 10 #include "src/jsregexp.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 << pre_allocated_property_fields() << "\n"; 409 << pre_allocated_property_fields() << "\n";
410 os << " - unused property fields: " << unused_property_fields() << "\n"; 410 os << " - unused property fields: " << unused_property_fields() << "\n";
411 if (is_dictionary_map()) os << " - dictionary_map\n"; 411 if (is_dictionary_map()) os << " - dictionary_map\n";
412 if (is_prototype_map()) os << " - prototype_map\n"; 412 if (is_prototype_map()) os << " - prototype_map\n";
413 if (is_hidden_prototype()) os << " - hidden_prototype\n"; 413 if (is_hidden_prototype()) os << " - hidden_prototype\n";
414 if (has_named_interceptor()) os << " - named_interceptor\n"; 414 if (has_named_interceptor()) os << " - named_interceptor\n";
415 if (has_indexed_interceptor()) os << " - indexed_interceptor\n"; 415 if (has_indexed_interceptor()) os << " - indexed_interceptor\n";
416 if (is_undetectable()) os << " - undetectable\n"; 416 if (is_undetectable()) os << " - undetectable\n";
417 if (has_instance_call_handler()) os << " - instance_call_handler\n"; 417 if (has_instance_call_handler()) os << " - instance_call_handler\n";
418 if (is_access_check_needed()) os << " - access_check_needed\n"; 418 if (is_access_check_needed()) os << " - access_check_needed\n";
419 if (is_frozen()) { 419 if (!is_extensible()) os << " - non-extensible\n";
420 os << " - frozen\n";
421 } else if (!is_extensible()) {
422 os << " - sealed\n";
423 }
424 os << " - back pointer: " << Brief(GetBackPointer()); 420 os << " - back pointer: " << Brief(GetBackPointer());
425 os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "") 421 os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "")
426 << "#" << NumberOfOwnDescriptors() << ": " 422 << "#" << NumberOfOwnDescriptors() << ": "
427 << Brief(instance_descriptors()); 423 << Brief(instance_descriptors());
428 if (FLAG_unbox_double_fields) { 424 if (FLAG_unbox_double_fields) {
429 os << "\n - layout descriptor: " << Brief(layout_descriptor()); 425 os << "\n - layout descriptor: " << Brief(layout_descriptor());
430 } 426 }
431 if (HasTransitionArray()) { 427 if (HasTransitionArray()) {
432 os << "\n - transitions: " << Brief(transitions()); 428 os << "\n - transitions: " << Brief(transitions());
433 } 429 }
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 for (int i = 0; i < number_of_transitions(); i++) { 1168 for (int i = 0; i < number_of_transitions(); i++) {
1173 Name* key = GetKey(i); 1169 Name* key = GetKey(i);
1174 Map* target = GetTarget(i); 1170 Map* target = GetTarget(i);
1175 os << " "; 1171 os << " ";
1176 #ifdef OBJECT_PRINT 1172 #ifdef OBJECT_PRINT
1177 key->NamePrint(os); 1173 key->NamePrint(os);
1178 #else 1174 #else
1179 key->ShortPrint(os); 1175 key->ShortPrint(os);
1180 #endif 1176 #endif
1181 os << ": "; 1177 os << ": ";
1182 if (key == GetHeap()->frozen_symbol()) { 1178 if (key == GetHeap()->nonextensible_symbol()) {
1179 os << " (transition to non-extensible)";
1180 } else if (key == GetHeap()->sealed_symbol()) {
1181 os << " (transition to sealed)";
1182 } else if (key == GetHeap()->frozen_symbol()) {
1183 os << " (transition to frozen)"; 1183 os << " (transition to frozen)";
1184 } else if (key == GetHeap()->elements_transition_symbol()) { 1184 } else if (key == GetHeap()->elements_transition_symbol()) {
1185 os << " (transition to " << ElementsKindToString(target->elements_kind()) 1185 os << " (transition to " << ElementsKindToString(target->elements_kind())
1186 << ")"; 1186 << ")";
1187 } else if (key == GetHeap()->observed_symbol()) { 1187 } else if (key == GetHeap()->observed_symbol()) {
1188 os << " (transition to Object.observe)"; 1188 os << " (transition to Object.observe)";
1189 } else { 1189 } else {
1190 PropertyDetails details = GetTargetDetails(key, target); 1190 PropertyDetails details = GetTargetDetails(key, target);
1191 switch (details.type()) { 1191 switch (details.type()) {
1192 case FIELD: { 1192 case FIELD: {
(...skipping 13 matching lines...) Expand all
1206 } 1206 }
1207 } 1207 }
1208 1208
1209 1209
1210 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT 1210 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
1211 if (!map()->HasTransitionArray()) return; 1211 if (!map()->HasTransitionArray()) return;
1212 map()->transitions()->PrintTransitions(os, false); 1212 map()->transitions()->PrintTransitions(os, false);
1213 } 1213 }
1214 #endif // defined(DEBUG) || defined(OBJECT_PRINT) 1214 #endif // defined(DEBUG) || defined(OBJECT_PRINT)
1215 } } // namespace v8::internal 1215 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698