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

Side by Side Diff: src/compiler.cc

Issue 606053: Enable passing of script data via script creation methods (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler.h ('k') | src/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 238
239 static StaticResource<SafeStringInputBuffer> safe_string_input_buffer; 239 static StaticResource<SafeStringInputBuffer> safe_string_input_buffer;
240 240
241 241
242 Handle<JSFunction> Compiler::Compile(Handle<String> source, 242 Handle<JSFunction> Compiler::Compile(Handle<String> source,
243 Handle<Object> script_name, 243 Handle<Object> script_name,
244 int line_offset, int column_offset, 244 int line_offset, int column_offset,
245 v8::Extension* extension, 245 v8::Extension* extension,
246 ScriptDataImpl* input_pre_data) { 246 ScriptDataImpl* input_pre_data,
247 Handle<Object> script_data) {
247 int source_length = source->length(); 248 int source_length = source->length();
248 Counters::total_load_size.Increment(source_length); 249 Counters::total_load_size.Increment(source_length);
249 Counters::total_compile_size.Increment(source_length); 250 Counters::total_compile_size.Increment(source_length);
250 251
251 // The VM is in the COMPILER state until exiting this function. 252 // The VM is in the COMPILER state until exiting this function.
252 VMState state(COMPILER); 253 VMState state(COMPILER);
253 254
254 // Do a lookup in the compilation cache but not for extensions. 255 // Do a lookup in the compilation cache but not for extensions.
255 Handle<JSFunction> result; 256 Handle<JSFunction> result;
256 if (extension == NULL) { 257 if (extension == NULL) {
(...skipping 13 matching lines...) Expand all
270 } 271 }
271 272
272 // Create a script object describing the script to be compiled. 273 // Create a script object describing the script to be compiled.
273 Handle<Script> script = Factory::NewScript(source); 274 Handle<Script> script = Factory::NewScript(source);
274 if (!script_name.is_null()) { 275 if (!script_name.is_null()) {
275 script->set_name(*script_name); 276 script->set_name(*script_name);
276 script->set_line_offset(Smi::FromInt(line_offset)); 277 script->set_line_offset(Smi::FromInt(line_offset));
277 script->set_column_offset(Smi::FromInt(column_offset)); 278 script->set_column_offset(Smi::FromInt(column_offset));
278 } 279 }
279 280
281 script->set_data(script_data.is_null() ? Heap::undefined_value()
282 : *script_data);
283
280 // Compile the function and add it to the cache. 284 // Compile the function and add it to the cache.
281 result = MakeFunction(true, 285 result = MakeFunction(true,
282 false, 286 false,
283 DONT_VALIDATE_JSON, 287 DONT_VALIDATE_JSON,
284 script, 288 script,
285 Handle<Context>::null(), 289 Handle<Context>::null(),
286 extension, 290 extension,
287 pre_data); 291 pre_data);
288 if (extension == NULL && !result.is_null()) { 292 if (extension == NULL && !result.is_null()) {
289 CompilationCache::PutScript(source, result); 293 CompilationCache::PutScript(source, result);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 fun->shared()->set_is_toplevel(is_toplevel); 560 fun->shared()->set_is_toplevel(is_toplevel);
557 fun->shared()->set_inferred_name(*lit->inferred_name()); 561 fun->shared()->set_inferred_name(*lit->inferred_name());
558 fun->shared()->SetThisPropertyAssignmentsInfo( 562 fun->shared()->SetThisPropertyAssignmentsInfo(
559 lit->has_only_simple_this_property_assignments(), 563 lit->has_only_simple_this_property_assignments(),
560 *lit->this_property_assignments()); 564 *lit->this_property_assignments());
561 fun->shared()->set_try_full_codegen(lit->try_full_codegen()); 565 fun->shared()->set_try_full_codegen(lit->try_full_codegen());
562 } 566 }
563 567
564 568
565 } } // namespace v8::internal 569 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698