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

Unified Diff: src/hydrogen.cc

Issue 712973002: harmony-scoping: Implement StoreIC handler for stores to global contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments + rebased 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/ic/ic.cc » ('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 4b52f26a84e7aa75bd9886d9e6beef2efc7b579e..b9b3eb0819c30ad6d141de5d7cadcb1351218b9b 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -3133,6 +3133,16 @@ HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) {
}
+HInstruction* HGraphBuilder::BuildGetGlobalContext(int context_index) {
+ HValue* native_context = BuildGetNativeContext();
+ HValue* global_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));
+}
+
+
HInstruction* HGraphBuilder::BuildGetNativeContext() {
// Get the global context, then the native context
HValue* global_object = Add<HLoadNamedField>(
@@ -6522,6 +6532,24 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
HValue* value,
BailoutId ast_id) {
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);
+ HStoreNamedField* instr = Add<HStoreNamedField>(
+ Add<HConstant>(global_context),
+ HObjectAccess::ForContextSlot(lookup.slot_index), value);
+ USE(instr);
+ DCHECK(instr->HasObservableSideEffects());
+ Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
+ return;
+ }
+ }
+
LookupIterator it(global, var->name(), LookupIterator::OWN_SKIP_INTERCEPTOR);
GlobalPropertyAccess type = LookupGlobalProperty(var, &it, STORE);
if (type == kUseCell) {
« no previous file with comments | « src/hydrogen.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698