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

Unified Diff: src/contexts.cc

Issue 6993008: Allow closures to be optimized if outer contexts that call eval are all in strict mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/contexts.h ('k') | src/scopeinfo.h » ('j') | src/scopes.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.cc
diff --git a/src/contexts.cc b/src/contexts.cc
index 520f3dde2444e4d87e5817ddb6f3e54c27edbcc1..2b09e57b87b6d91cb5edc61f297cd615d89b65ef 100644
--- a/src/contexts.cc
+++ b/src/contexts.cc
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -243,6 +243,28 @@ bool Context::GlobalIfNotShadowedByEval(Handle<String> name) {
}
+void Context::ComputeEvalScopeInfo(bool* outer_scope_calls_eval,
+ bool* outer_scope_calls_non_strict_eval) {
+ Context* context = this;
+ bool follow_chains = true;
+ while (follow_chains) {
+ Handle<SerializedScopeInfo> scope_info(
+ context->closure()->shared()->scope_info());
+ if (scope_info->CallsEval()) {
+ *outer_scope_calls_eval = true;
+ if (!scope_info->IsStrictMode()) {
+ // No need to go further since the answers will not change
+ // from here.
+ *outer_scope_calls_non_strict_eval = true;
+ return;
+ }
+ }
+ if (context->IsGlobalContext()) follow_chains = false;
fschneider 2011/05/11 10:35:11 small simplification? while (true) { ... if
Mads Ager (chromium) 2011/05/11 11:24:11 Done.
+ context = Context::cast(context->closure()->context());
+ }
+}
+
+
void Context::AddOptimizedFunction(JSFunction* function) {
ASSERT(IsGlobalContext());
#ifdef DEBUG
« no previous file with comments | « src/contexts.h ('k') | src/scopeinfo.h » ('j') | src/scopes.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698