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

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

Issue 1292753007: [es6] Parameter scopes for sloppy eval (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
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/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 HandleScope scope(isolate); 417 HandleScope scope(isolate);
418 DCHECK_EQ(1, args.length()); 418 DCHECK_EQ(1, args.length());
419 CONVERT_SMI_ARG_CHECKED(slot, 0); 419 CONVERT_SMI_ARG_CHECKED(slot, 0);
420 420
421 // Go up context chain to the script context. 421 // Go up context chain to the script context.
422 Handle<Context> script_context(isolate->context()->script_context(), isolate); 422 Handle<Context> script_context(isolate->context()->script_context(), isolate);
423 DCHECK(script_context->IsScriptContext()); 423 DCHECK(script_context->IsScriptContext());
424 DCHECK(script_context->get(slot)->IsPropertyCell()); 424 DCHECK(script_context->get(slot)->IsPropertyCell());
425 425
426 // Lookup the named property on the global object. 426 // Lookup the named property on the global object.
427 Handle<ScopeInfo> scope_info(ScopeInfo::cast(script_context->extension()), 427 Handle<ScopeInfo> scope_info(script_context->scope_info(), isolate);
428 isolate);
429 Handle<Name> name(scope_info->ContextSlotName(slot), isolate); 428 Handle<Name> name(scope_info->ContextSlotName(slot), isolate);
430 Handle<GlobalObject> global_object(script_context->global_object(), isolate); 429 Handle<GlobalObject> global_object(script_context->global_object(), isolate);
431 LookupIterator it(global_object, name, LookupIterator::HIDDEN); 430 LookupIterator it(global_object, name, LookupIterator::HIDDEN);
432 431
433 // Switch to fast mode only if there is a data property and it's not on 432 // Switch to fast mode only if there is a data property and it's not on
434 // a hidden prototype. 433 // a hidden prototype.
435 if (it.state() == LookupIterator::DATA && 434 if (it.state() == LookupIterator::DATA &&
436 it.GetHolder<Object>().is_identical_to(global_object)) { 435 it.GetHolder<Object>().is_identical_to(global_object)) {
437 // Now update the cell in the script context. 436 // Now update the cell in the script context.
438 Handle<PropertyCell> cell = it.GetPropertyCell(); 437 Handle<PropertyCell> cell = it.GetPropertyCell();
(...skipping 13 matching lines...) Expand all
452 namespace { 451 namespace {
453 452
454 Object* StoreGlobalViaContext(Isolate* isolate, int slot, Handle<Object> value, 453 Object* StoreGlobalViaContext(Isolate* isolate, int slot, Handle<Object> value,
455 LanguageMode language_mode) { 454 LanguageMode language_mode) {
456 // Go up context chain to the script context. 455 // Go up context chain to the script context.
457 Handle<Context> script_context(isolate->context()->script_context(), isolate); 456 Handle<Context> script_context(isolate->context()->script_context(), isolate);
458 DCHECK(script_context->IsScriptContext()); 457 DCHECK(script_context->IsScriptContext());
459 DCHECK(script_context->get(slot)->IsPropertyCell()); 458 DCHECK(script_context->get(slot)->IsPropertyCell());
460 459
461 // Lookup the named property on the global object. 460 // Lookup the named property on the global object.
462 Handle<ScopeInfo> scope_info(ScopeInfo::cast(script_context->extension()), 461 Handle<ScopeInfo> scope_info(script_context->scope_info(), isolate);
463 isolate);
464 Handle<Name> name(scope_info->ContextSlotName(slot), isolate); 462 Handle<Name> name(scope_info->ContextSlotName(slot), isolate);
465 Handle<GlobalObject> global_object(script_context->global_object(), isolate); 463 Handle<GlobalObject> global_object(script_context->global_object(), isolate);
466 LookupIterator it(global_object, name, LookupIterator::HIDDEN); 464 LookupIterator it(global_object, name, LookupIterator::HIDDEN);
467 465
468 // Switch to fast mode only if there is a data property and it's not on 466 // Switch to fast mode only if there is a data property and it's not on
469 // a hidden prototype. 467 // a hidden prototype.
470 if (it.state() == LookupIterator::DATA && 468 if (it.state() == LookupIterator::DATA &&
471 it.GetHolder<Object>().is_identical_to(global_object)) { 469 it.GetHolder<Object>().is_identical_to(global_object)) {
472 // Now update cell in the script context. 470 // Now update cell in the script context.
473 Handle<PropertyCell> cell = it.GetPropertyCell(); 471 Handle<PropertyCell> cell = it.GetPropertyCell();
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 SealHandleScope scope(isolate); 1464 SealHandleScope scope(isolate);
1467 DCHECK_EQ(2, args.length()); 1465 DCHECK_EQ(2, args.length());
1468 CONVERT_ARG_CHECKED(Object, x, 0); 1466 CONVERT_ARG_CHECKED(Object, x, 0);
1469 CONVERT_ARG_CHECKED(Object, y, 1); 1467 CONVERT_ARG_CHECKED(Object, y, 1);
1470 // TODO(bmeurer): Change this at some point to return true/false instead. 1468 // TODO(bmeurer): Change this at some point to return true/false instead.
1471 return Smi::FromInt(x->StrictEquals(y) ? EQUAL : NOT_EQUAL); 1469 return Smi::FromInt(x->StrictEquals(y) ? EQUAL : NOT_EQUAL);
1472 } 1470 }
1473 1471
1474 } // namespace internal 1472 } // namespace internal
1475 } // namespace v8 1473 } // namespace v8
OLDNEW
« src/contexts.cc ('K') | « src/pattern-rewriter.cc ('k') | src/runtime/runtime-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698