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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 694533003: Add FLAG_trace_maps (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/runtime/runtime-literals.cc ('k') | src/runtime/runtime-scopes.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/runtime/runtime.h" 10 #include "src/runtime/runtime.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 462
463 463
464 RUNTIME_FUNCTION(Runtime_DisableAccessChecks) { 464 RUNTIME_FUNCTION(Runtime_DisableAccessChecks) {
465 HandleScope scope(isolate); 465 HandleScope scope(isolate);
466 DCHECK(args.length() == 1); 466 DCHECK(args.length() == 1);
467 CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0); 467 CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0);
468 Handle<Map> old_map(object->map()); 468 Handle<Map> old_map(object->map());
469 bool needs_access_checks = old_map->is_access_check_needed(); 469 bool needs_access_checks = old_map->is_access_check_needed();
470 if (needs_access_checks) { 470 if (needs_access_checks) {
471 // Copy map so it won't interfere constructor's initial map. 471 // Copy map so it won't interfere constructor's initial map.
472 Handle<Map> new_map = Map::Copy(old_map); 472 Handle<Map> new_map = Map::Copy(old_map, "DisableAccessChecks");
473 new_map->set_is_access_check_needed(false); 473 new_map->set_is_access_check_needed(false);
474 JSObject::MigrateToMap(Handle<JSObject>::cast(object), new_map); 474 JSObject::MigrateToMap(Handle<JSObject>::cast(object), new_map);
475 } 475 }
476 return isolate->heap()->ToBoolean(needs_access_checks); 476 return isolate->heap()->ToBoolean(needs_access_checks);
477 } 477 }
478 478
479 479
480 RUNTIME_FUNCTION(Runtime_EnableAccessChecks) { 480 RUNTIME_FUNCTION(Runtime_EnableAccessChecks) {
481 HandleScope scope(isolate); 481 HandleScope scope(isolate);
482 DCHECK(args.length() == 1); 482 DCHECK(args.length() == 1);
483 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 483 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
484 Handle<Map> old_map(object->map()); 484 Handle<Map> old_map(object->map());
485 RUNTIME_ASSERT(!old_map->is_access_check_needed()); 485 RUNTIME_ASSERT(!old_map->is_access_check_needed());
486 // Copy map so it won't interfere constructor's initial map. 486 // Copy map so it won't interfere constructor's initial map.
487 Handle<Map> new_map = Map::Copy(old_map); 487 Handle<Map> new_map = Map::Copy(old_map, "EnableAccessChecks");
488 new_map->set_is_access_check_needed(true); 488 new_map->set_is_access_check_needed(true);
489 JSObject::MigrateToMap(object, new_map); 489 JSObject::MigrateToMap(object, new_map);
490 return isolate->heap()->undefined_value(); 490 return isolate->heap()->undefined_value();
491 } 491 }
492 492
493 493
494 RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) { 494 RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) {
495 HandleScope scope(isolate); 495 HandleScope scope(isolate);
496 DCHECK(args.length() == 2); 496 DCHECK(args.length() == 2);
497 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 497 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
498 CONVERT_SMI_ARG_CHECKED(properties, 1); 498 CONVERT_SMI_ARG_CHECKED(properties, 1);
499 // Conservative upper limit to prevent fuzz tests from going OOM. 499 // Conservative upper limit to prevent fuzz tests from going OOM.
500 RUNTIME_ASSERT(properties <= 100000); 500 RUNTIME_ASSERT(properties <= 100000);
501 if (object->HasFastProperties() && !object->IsJSGlobalProxy()) { 501 if (object->HasFastProperties() && !object->IsJSGlobalProxy()) {
502 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties); 502 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties,
503 "OptimizeForAdding");
503 } 504 }
504 return *object; 505 return *object;
505 } 506 }
506 507
507 508
508 RUNTIME_FUNCTION(Runtime_ObjectFreeze) { 509 RUNTIME_FUNCTION(Runtime_ObjectFreeze) {
509 HandleScope scope(isolate); 510 HandleScope scope(isolate);
510 DCHECK(args.length() == 1); 511 DCHECK(args.length() == 1);
511 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 512 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
512 513
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 } 1146 }
1146 return *isolate->factory()->NewJSArrayWithElements(copy); 1147 return *isolate->factory()->NewJSArrayWithElements(copy);
1147 } 1148 }
1148 1149
1149 1150
1150 RUNTIME_FUNCTION(Runtime_ToFastProperties) { 1151 RUNTIME_FUNCTION(Runtime_ToFastProperties) {
1151 HandleScope scope(isolate); 1152 HandleScope scope(isolate);
1152 DCHECK(args.length() == 1); 1153 DCHECK(args.length() == 1);
1153 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 1154 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
1154 if (object->IsJSObject() && !object->IsGlobalObject()) { 1155 if (object->IsJSObject() && !object->IsGlobalObject()) {
1155 JSObject::MigrateSlowToFast(Handle<JSObject>::cast(object), 0); 1156 JSObject::MigrateSlowToFast(Handle<JSObject>::cast(object), 0,
1157 "RuntimeToFastProperties");
1156 } 1158 }
1157 return *object; 1159 return *object;
1158 } 1160 }
1159 1161
1160 1162
1161 RUNTIME_FUNCTION(Runtime_ToBool) { 1163 RUNTIME_FUNCTION(Runtime_ToBool) {
1162 SealHandleScope shs(isolate); 1164 SealHandleScope shs(isolate);
1163 DCHECK(args.length() == 1); 1165 DCHECK(args.length() == 1);
1164 CONVERT_ARG_CHECKED(Object, object, 0); 1166 CONVERT_ARG_CHECKED(Object, object, 0);
1165 1167
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 RUNTIME_ASSERT(IsValidAccessor(getter)); 1451 RUNTIME_ASSERT(IsValidAccessor(getter));
1450 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3); 1452 CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3);
1451 RUNTIME_ASSERT(IsValidAccessor(setter)); 1453 RUNTIME_ASSERT(IsValidAccessor(setter));
1452 CONVERT_SMI_ARG_CHECKED(unchecked, 4); 1454 CONVERT_SMI_ARG_CHECKED(unchecked, 4);
1453 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); 1455 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
1454 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); 1456 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);
1455 1457
1456 bool fast = obj->HasFastProperties(); 1458 bool fast = obj->HasFastProperties();
1457 RETURN_FAILURE_ON_EXCEPTION( 1459 RETURN_FAILURE_ON_EXCEPTION(
1458 isolate, JSObject::DefineAccessor(obj, name, getter, setter, attr)); 1460 isolate, JSObject::DefineAccessor(obj, name, getter, setter, attr));
1459 if (fast) JSObject::MigrateSlowToFast(obj, 0); 1461 if (fast) JSObject::MigrateSlowToFast(obj, 0, "RuntimeDefineAccessor");
1460 return isolate->heap()->undefined_value(); 1462 return isolate->heap()->undefined_value();
1461 } 1463 }
1462 1464
1463 1465
1464 // Implements part of 8.12.9 DefineOwnProperty. 1466 // Implements part of 8.12.9 DefineOwnProperty.
1465 // There are 3 cases that lead here: 1467 // There are 3 cases that lead here:
1466 // Step 4a - define a new data property. 1468 // Step 4a - define a new data property.
1467 // Steps 9b & 12 - replace an existing accessor property with a data property. 1469 // Steps 9b & 12 - replace an existing accessor property with a data property.
1468 // Step 12 - update an existing data property with a data or generic 1470 // Step 12 - update an existing data property with a data or generic
1469 // descriptor. 1471 // descriptor.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 1580
1579 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { 1581 RUNTIME_FUNCTION(RuntimeReference_ClassOf) {
1580 SealHandleScope shs(isolate); 1582 SealHandleScope shs(isolate);
1581 DCHECK(args.length() == 1); 1583 DCHECK(args.length() == 1);
1582 CONVERT_ARG_CHECKED(Object, obj, 0); 1584 CONVERT_ARG_CHECKED(Object, obj, 0);
1583 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); 1585 if (!obj->IsJSReceiver()) return isolate->heap()->null_value();
1584 return JSReceiver::cast(obj)->class_name(); 1586 return JSReceiver::cast(obj)->class_name();
1585 } 1587 }
1586 } 1588 }
1587 } // namespace v8::internal 1589 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime-literals.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698