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

Unified Diff: src/compiler.cc

Issue 28027: Speed up access to global variables from eval scopes. Traverse the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 10 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
Index: src/compiler.cc
===================================================================
--- src/compiler.cc (revision 1344)
+++ src/compiler.cc (working copy)
@@ -40,6 +40,7 @@
static Handle<Code> MakeCode(FunctionLiteral* literal,
Handle<Script> script,
+ Handle<Context> context,
bool is_eval) {
ASSERT(literal != NULL);
@@ -55,7 +56,7 @@
// so this doesn't re-allocate variables repeatedly.
Scope* top = literal->scope();
while (top->outer_scope() != NULL) top = top->outer_scope();
- top->AllocateVariables();
+ top->AllocateVariables(context);
#ifdef DEBUG
if (Bootstrapper::IsActive() ?
@@ -81,6 +82,7 @@
static Handle<JSFunction> MakeFunction(bool is_global,
bool is_eval,
Handle<Script> script,
+ Handle<Context> context,
v8::Extension* extension,
ScriptDataImpl* pre_data) {
ZoneScope zone_scope(DELETE_ON_EXIT);
@@ -113,7 +115,7 @@
StatsRateScope timer(rate);
// Compile the code.
- Handle<Code> code = MakeCode(lit, script, is_eval);
+ Handle<Code> code = MakeCode(lit, script, context, is_eval);
// Check for stack-overflow exceptions.
if (code.is_null()) {
@@ -201,7 +203,12 @@
}
// Compile the function and add it to the cache.
- result = MakeFunction(true, false, script, extension, pre_data);
+ result = MakeFunction(true,
+ false,
+ script,
+ Handle<Context>::null(),
+ extension,
+ pre_data);
if (extension == NULL && !result.is_null()) {
CompilationCache::PutFunction(source, CompilationCache::SCRIPT, result);
}
@@ -219,6 +226,7 @@
Handle<JSFunction> Compiler::CompileEval(Handle<String> source,
+ Handle<Context> context,
int line_offset,
bool is_global) {
int source_length = source->length();
@@ -233,14 +241,15 @@
// Do a lookup in the compilation cache; if the entry is not there,
// invoke the compiler and add the result to the cache.
- Handle<JSFunction> result = CompilationCache::LookupEval(source, entry);
+ Handle<JSFunction> result =
+ CompilationCache::LookupEval(source, context, entry);
if (result.is_null()) {
// Create a script object describing the script to be compiled.
Handle<Script> script = Factory::NewScript(source);
script->set_line_offset(Smi::FromInt(line_offset));
- result = MakeFunction(is_global, true, script, NULL, NULL);
+ result = MakeFunction(is_global, true, script, context, NULL, NULL);
if (!result.is_null()) {
- CompilationCache::PutFunction(source, entry, result);
+ CompilationCache::PutEvalFunction(source, context, entry, result);
}
}
@@ -290,7 +299,7 @@
StatsRateScope timer(&Counters::compile_lazy);
// Compile the code.
- Handle<Code> code = MakeCode(lit, script, false);
+ Handle<Code> code = MakeCode(lit, script, Handle<Context>::null(), false);
// Check for stack-overflow exception.
if (code.is_null()) {

Powered by Google App Engine
This is Rietveld 408576698