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

Side by Side Diff: src/runtime/runtime-object.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/runtime/runtime.h ('k') | src/transitions-inl.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 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // %ObjectFreeze is a fast path and these cases are handled elsewhere. 523 // %ObjectFreeze is a fast path and these cases are handled elsewhere.
524 RUNTIME_ASSERT(!object->HasSloppyArgumentsElements() && 524 RUNTIME_ASSERT(!object->HasSloppyArgumentsElements() &&
525 !object->map()->is_observed() && !object->IsJSProxy()); 525 !object->map()->is_observed() && !object->IsJSProxy());
526 526
527 Handle<Object> result; 527 Handle<Object> result;
528 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, JSObject::Freeze(object)); 528 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, JSObject::Freeze(object));
529 return *result; 529 return *result;
530 } 530 }
531 531
532 532
533 RUNTIME_FUNCTION(Runtime_ObjectSeal) {
534 HandleScope scope(isolate);
535 DCHECK(args.length() == 1);
536 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
537
538 // %ObjectSeal is a fast path and these cases are handled elsewhere.
539 RUNTIME_ASSERT(!object->HasSloppyArgumentsElements() &&
540 !object->map()->is_observed() && !object->IsJSProxy());
541
542 Handle<Object> result;
543 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, JSObject::Seal(object));
544 return *result;
545 }
546
547
533 RUNTIME_FUNCTION(Runtime_GetProperty) { 548 RUNTIME_FUNCTION(Runtime_GetProperty) {
534 HandleScope scope(isolate); 549 HandleScope scope(isolate);
535 DCHECK(args.length() == 2); 550 DCHECK(args.length() == 2);
536 551
537 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); 552 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
538 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); 553 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
539 Handle<Object> result; 554 Handle<Object> result;
540 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 555 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
541 isolate, result, Runtime::GetObjectProperty(isolate, object, key)); 556 isolate, result, Runtime::GetObjectProperty(isolate, object, key));
542 return *result; 557 return *result;
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 1600
1586 RUNTIME_FUNCTION(RuntimeReference_ClassOf) { 1601 RUNTIME_FUNCTION(RuntimeReference_ClassOf) {
1587 SealHandleScope shs(isolate); 1602 SealHandleScope shs(isolate);
1588 DCHECK(args.length() == 1); 1603 DCHECK(args.length() == 1);
1589 CONVERT_ARG_CHECKED(Object, obj, 0); 1604 CONVERT_ARG_CHECKED(Object, obj, 0);
1590 if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); 1605 if (!obj->IsJSReceiver()) return isolate->heap()->null_value();
1591 return JSReceiver::cast(obj)->class_name(); 1606 return JSReceiver::cast(obj)->class_name();
1592 } 1607 }
1593 } 1608 }
1594 } // namespace v8::internal 1609 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698