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

Unified Diff: src/hydrogen.cc

Issue 716833002: Various clean-ups after top-level lexical declarations are done. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Patch for landing 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index e91609dba4387ae6c75f80dca8fe84b7ec960a50..834af7245ff295166935394cdaa6411bfbdea052 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -3119,7 +3119,7 @@ void HGraphBuilder::BuildCreateAllocationMemento(
HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) {
- // Get the global context, then the native context
+ // Get the global object, then the native context
HInstruction* context =
Add<HLoadNamedField>(closure, static_cast<HValue*>(NULL),
HObjectAccess::ForFunctionContextPointer());
@@ -3133,18 +3133,18 @@ HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) {
}
-HInstruction* HGraphBuilder::BuildGetGlobalContext(int context_index) {
+HInstruction* HGraphBuilder::BuildGetScriptContext(int context_index) {
HValue* native_context = BuildGetNativeContext();
- HValue* global_context_table = Add<HLoadNamedField>(
+ HValue* script_context_table = Add<HLoadNamedField>(
native_context, static_cast<HValue*>(NULL),
- HObjectAccess::ForContextSlot(Context::GLOBAL_CONTEXT_TABLE_INDEX));
- return Add<HLoadNamedField>(global_context_table, static_cast<HValue*>(NULL),
- HObjectAccess::ForGlobalContext(context_index));
+ HObjectAccess::ForContextSlot(Context::SCRIPT_CONTEXT_TABLE_INDEX));
+ return Add<HLoadNamedField>(script_context_table, static_cast<HValue*>(NULL),
+ HObjectAccess::ForScriptContext(context_index));
}
HInstruction* HGraphBuilder::BuildGetNativeContext() {
- // Get the global context, then the native context
+ // Get the global object, then the native context
HValue* global_object = Add<HLoadNamedField>(
context(), static_cast<HValue*>(NULL),
HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
@@ -4565,7 +4565,7 @@ void HOptimizedGraphBuilder::VisitBlock(Block* stmt) {
Scope* declaration_scope = scope->DeclarationScope();
HInstruction* function;
HValue* outer_context = environment()->context();
- if (declaration_scope->is_global_scope() ||
+ if (declaration_scope->is_script_scope() ||
declaration_scope->is_eval_scope()) {
function = new(zone()) HLoadContextSlot(
outer_context, Context::CLOSURE_INDEX, HLoadContextSlot::kNoCheck);
@@ -5388,15 +5388,15 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
Handle<GlobalObject> global(current_info()->global_object());
if (FLAG_harmony_scoping) {
- Handle<GlobalContextTable> global_contexts(
- global->native_context()->global_context_table());
- GlobalContextTable::LookupResult lookup;
- if (GlobalContextTable::Lookup(global_contexts, variable->name(),
+ Handle<ScriptContextTable> script_contexts(
+ global->native_context()->script_context_table());
+ ScriptContextTable::LookupResult lookup;
+ if (ScriptContextTable::Lookup(script_contexts, variable->name(),
&lookup)) {
- Handle<Context> global_context = GlobalContextTable::GetContext(
- global_contexts, lookup.context_index);
+ Handle<Context> script_context = ScriptContextTable::GetContext(
+ script_contexts, lookup.context_index);
HInstruction* result = New<HLoadNamedField>(
- Add<HConstant>(global_context), static_cast<HValue*>(NULL),
+ Add<HConstant>(script_context), static_cast<HValue*>(NULL),
HObjectAccess::ForContextSlot(lookup.slot_index));
return ast_context()->ReturnInstruction(result, expr->id());
}
@@ -6544,14 +6544,14 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
Handle<GlobalObject> global(current_info()->global_object());
if (FLAG_harmony_scoping) {
- Handle<GlobalContextTable> global_contexts(
- global->native_context()->global_context_table());
- GlobalContextTable::LookupResult lookup;
- if (GlobalContextTable::Lookup(global_contexts, var->name(), &lookup)) {
- Handle<Context> global_context =
- GlobalContextTable::GetContext(global_contexts, lookup.context_index);
+ Handle<ScriptContextTable> script_contexts(
+ global->native_context()->script_context_table());
+ ScriptContextTable::LookupResult lookup;
+ if (ScriptContextTable::Lookup(script_contexts, var->name(), &lookup)) {
+ Handle<Context> script_context =
+ ScriptContextTable::GetContext(script_contexts, lookup.context_index);
HStoreNamedField* instr = Add<HStoreNamedField>(
- Add<HConstant>(global_context),
+ Add<HConstant>(script_context),
HObjectAccess::ForContextSlot(lookup.slot_index), value);
USE(instr);
DCHECK(instr->HasObservableSideEffects());
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698