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

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

Issue 1254143003: [stubs] Also handle properties of the JSBuiltinsObject in the fast case. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months 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/bootstrapper.cc ('k') | no next file » | 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/messages.h" 10 #include "src/messages.h"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 430
431 // Lookup the named property on the global object. 431 // Lookup the named property on the global object.
432 Handle<ScopeInfo> scope_info(ScopeInfo::cast(script_context->extension()), 432 Handle<ScopeInfo> scope_info(ScopeInfo::cast(script_context->extension()),
433 isolate); 433 isolate);
434 Handle<Name> name(scope_info->ContextSlotName(slot), isolate); 434 Handle<Name> name(scope_info->ContextSlotName(slot), isolate);
435 Handle<GlobalObject> global_object(script_context->global_object(), isolate); 435 Handle<GlobalObject> global_object(script_context->global_object(), isolate);
436 LookupIterator it(global_object, name, LookupIterator::HIDDEN); 436 LookupIterator it(global_object, name, LookupIterator::HIDDEN);
437 437
438 // Switch to fast mode only if there is a data property and it's not on 438 // Switch to fast mode only if there is a data property and it's not on
439 // a hidden prototype. 439 // a hidden prototype.
440 if (LookupIterator::DATA == it.state() && 440 if (it.state() == LookupIterator::DATA &&
441 it.GetHolder<Object>()->IsJSGlobalObject()) { 441 it.GetHolder<Object>().is_identical_to(global_object)) {
442 // Now update the cell in the script context. 442 // Now update the cell in the script context.
443 Handle<PropertyCell> cell = it.GetPropertyCell(); 443 Handle<PropertyCell> cell = it.GetPropertyCell();
444 script_context->set(slot, *cell); 444 script_context->set(slot, *cell);
445 } else { 445 } else {
446 // This is not a fast case, so keep this access in a slow mode. 446 // This is not a fast case, so keep this access in a slow mode.
447 // Store empty_property_cell here to release the outdated property cell. 447 // Store empty_property_cell here to release the outdated property cell.
448 script_context->set(slot, isolate->heap()->empty_property_cell()); 448 script_context->set(slot, isolate->heap()->empty_property_cell());
449 } 449 }
450 450
451 Handle<Object> result; 451 Handle<Object> result;
(...skipping 10 matching lines...) Expand all
462 Handle<Context> script_context(isolate->context()->script_context(), isolate); 462 Handle<Context> script_context(isolate->context()->script_context(), isolate);
463 DCHECK(script_context->IsScriptContext()); 463 DCHECK(script_context->IsScriptContext());
464 DCHECK(script_context->get(slot)->IsPropertyCell()); 464 DCHECK(script_context->get(slot)->IsPropertyCell());
465 465
466 // Lookup the named property on the global object. 466 // Lookup the named property on the global object.
467 Handle<ScopeInfo> scope_info(ScopeInfo::cast(script_context->extension()), 467 Handle<ScopeInfo> scope_info(ScopeInfo::cast(script_context->extension()),
468 isolate); 468 isolate);
469 Handle<Name> name(scope_info->ContextSlotName(slot), isolate); 469 Handle<Name> name(scope_info->ContextSlotName(slot), isolate);
470 Handle<GlobalObject> global_object(script_context->global_object(), isolate); 470 Handle<GlobalObject> global_object(script_context->global_object(), isolate);
471 LookupIterator it(global_object, name, LookupIterator::HIDDEN); 471 LookupIterator it(global_object, name, LookupIterator::HIDDEN);
472
472 // Switch to fast mode only if there is a data property and it's not on 473 // Switch to fast mode only if there is a data property and it's not on
473 // a hidden prototype. 474 // a hidden prototype.
474 if (LookupIterator::DATA == it.state() && 475 if (it.state() == LookupIterator::DATA &&
475 it.GetHolder<Object>()->IsJSGlobalObject()) { 476 it.GetHolder<Object>().is_identical_to(global_object)) {
476 // Now update cell in the script context. 477 // Now update cell in the script context.
477 Handle<PropertyCell> cell = it.GetPropertyCell(); 478 Handle<PropertyCell> cell = it.GetPropertyCell();
478 script_context->set(slot, *cell); 479 script_context->set(slot, *cell);
479 } else { 480 } else {
480 // This is not a fast case, so keep this access in a slow mode. 481 // This is not a fast case, so keep this access in a slow mode.
481 // Store empty_property_cell here to release the outdated property cell. 482 // Store empty_property_cell here to release the outdated property cell.
482 script_context->set(slot, isolate->heap()->empty_property_cell()); 483 script_context->set(slot, isolate->heap()->empty_property_cell());
483 } 484 }
484 485
485 Handle<Object> result; 486 Handle<Object> result;
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3); 1456 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
1456 1457
1457 RETURN_FAILURE_ON_EXCEPTION( 1458 RETURN_FAILURE_ON_EXCEPTION(
1458 isolate, 1459 isolate,
1459 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), 1460 JSObject::DefineAccessor(object, name, isolate->factory()->null_value(),
1460 setter, attrs)); 1461 setter, attrs));
1461 return isolate->heap()->undefined_value(); 1462 return isolate->heap()->undefined_value();
1462 } 1463 }
1463 } // namespace internal 1464 } // namespace internal
1464 } // namespace v8 1465 } // namespace v8
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698