diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-07-14 11:16:20 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-07-14 11:16:20 -0700 |
commit | 8e2530c320d19717ffd3a2685a41e277e35235fd (patch) | |
tree | f11fd572cc3e50fc1ca9db2eac88ccd32b52589c /deps/v8/src/compiler.cc | |
parent | 870aa3d97f65a58f80e8347c796f5ba685410462 (diff) | |
download | node-8e2530c320d19717ffd3a2685a41e277e35235fd.tar.gz |
Upgrade V8 to 2.2.24
Diffstat (limited to 'deps/v8/src/compiler.cc')
-rwxr-xr-x | deps/v8/src/compiler.cc | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/deps/v8/src/compiler.cc b/deps/v8/src/compiler.cc index ebb974356..ec6b5ffb4 100755 --- a/deps/v8/src/compiler.cc +++ b/deps/v8/src/compiler.cc @@ -40,6 +40,7 @@ #include "oprofile-agent.h" #include "rewriter.h" #include "scopes.h" +#include "scopeinfo.h" namespace v8 { namespace internal { @@ -156,7 +157,12 @@ static Handle<Code> MakeCode(Handle<Context> context, CompilationInfo* info) { #ifdef ENABLE_DEBUGGER_SUPPORT Handle<Code> MakeCodeForLiveEdit(CompilationInfo* info) { Handle<Context> context = Handle<Context>::null(); - return MakeCode(context, info); + Handle<Code> code = MakeCode(context, info); + if (!info->shared_info().is_null()) { + info->shared_info()->set_scope_info( + *ScopeInfo<>::CreateHeapObject(info->scope())); + } + return code; } #endif @@ -252,9 +258,11 @@ static Handle<SharedFunctionInfo> MakeFunctionInfo(bool is_global, // Allocate function. Handle<SharedFunctionInfo> result = - Factory::NewSharedFunctionInfo(lit->name(), - lit->materialized_literal_count(), - code); + Factory::NewSharedFunctionInfo( + lit->name(), + lit->materialized_literal_count(), + code, + ScopeInfo<>::CreateHeapObject(info.scope())); ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); Compiler::SetFunctionInfo(result, lit, true, script); @@ -275,9 +283,6 @@ static Handle<SharedFunctionInfo> MakeFunctionInfo(bool is_global, } -static StaticResource<SafeStringInputBuffer> safe_string_input_buffer; - - Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source, Handle<Object> script_name, int line_offset, @@ -306,9 +311,7 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source, // No cache entry found. Do pre-parsing and compile the script. ScriptDataImpl* pre_data = input_pre_data; if (pre_data == NULL && source_length >= FLAG_min_preparse_length) { - Access<SafeStringInputBuffer> buf(&safe_string_input_buffer); - buf->Reset(source.location()); - pre_data = PreParse(source, buf.value(), extension); + pre_data = PreParse(source, NULL, extension); } // Create a script object describing the script to be compiled. @@ -445,8 +448,9 @@ bool Compiler::CompileLazy(CompilationInfo* info) { info->script(), code); - // Update the shared function info with the compiled code. + // Update the shared function info with the compiled code and the scope info. shared->set_code(*code); + shared->set_scope_info(*ScopeInfo<>::CreateHeapObject(info->scope())); // Set the expected number of properties for instances. SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); @@ -481,6 +485,8 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, bool allow_lazy = literal->AllowsLazyCompilation() && !LiveEditFunctionTracker::IsActive(); + Handle<Object> scope_info(ScopeInfo<>::EmptyHeapObject()); + // Generate code Handle<Code> code; if (FLAG_lazy && allow_lazy) { @@ -562,13 +568,15 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal, literal->start_position(), script, code); + scope_info = ScopeInfo<>::CreateHeapObject(info.scope()); } // Create a shared function info object. Handle<SharedFunctionInfo> result = Factory::NewSharedFunctionInfo(literal->name(), literal->materialized_literal_count(), - code); + code, + scope_info); SetFunctionInfo(result, literal, false, script); // Set the expected number of properties for instances and return |