OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 : SelectCompileFunction(cache_options, cache_handler, code_cache, | 497 : SelectCompileFunction(cache_options, cache_handler, code_cache, |
498 code, cacheability_if_no_handler); | 498 code, cacheability_if_no_handler); |
499 | 499 |
500 return (*compile_fn)(isolate, code, origin); | 500 return (*compile_fn)(isolate, code, origin); |
501 } | 501 } |
502 | 502 |
503 v8::MaybeLocal<v8::Module> V8ScriptRunner::CompileModule( | 503 v8::MaybeLocal<v8::Module> V8ScriptRunner::CompileModule( |
504 v8::Isolate* isolate, | 504 v8::Isolate* isolate, |
505 const String& source, | 505 const String& source, |
506 const String& file_name, | 506 const String& file_name, |
507 AccessControlStatus access_control_status) { | 507 AccessControlStatus access_control_status, |
| 508 const TextPosition& start_position) { |
508 TRACE_EVENT1("v8", "v8.compileModule", "fileName", file_name.Utf8()); | 509 TRACE_EVENT1("v8", "v8.compileModule", "fileName", file_name.Utf8()); |
509 // TODO(adamk): Add Inspector integration? | 510 // TODO(adamk): Add Inspector integration? |
510 // TODO(adamk): Pass more info into ScriptOrigin. | 511 // TODO(adamk): Pass more info into ScriptOrigin. |
511 v8::ScriptOrigin origin( | 512 v8::ScriptOrigin origin( |
512 V8String(isolate, file_name), | 513 V8String(isolate, file_name), |
513 v8::Integer::New(isolate, 0), // line_offset | 514 v8::Integer::New(isolate, start_position.line_.ZeroBasedInt()), |
514 v8::Integer::New(isolate, 0), // col_offset | 515 v8::Integer::New(isolate, start_position.column_.ZeroBasedInt()), |
515 v8::Boolean::New(isolate, access_control_status == kSharableCrossOrigin), | 516 v8::Boolean::New(isolate, access_control_status == kSharableCrossOrigin), |
516 v8::Local<v8::Integer>(), // script id | 517 v8::Local<v8::Integer>(), // script id |
517 v8::String::Empty(isolate), // source_map_url | 518 v8::String::Empty(isolate), // source_map_url |
518 v8::Boolean::New(isolate, access_control_status == kOpaqueResource), | 519 v8::Boolean::New(isolate, access_control_status == kOpaqueResource), |
519 v8::False(isolate), // is_wasm | 520 v8::False(isolate), // is_wasm |
520 v8::True(isolate)); // is_module | 521 v8::True(isolate)); // is_module |
521 | 522 |
522 v8::ScriptCompiler::Source script_source(V8String(isolate, source), origin); | 523 v8::ScriptCompiler::Source script_source(V8String(isolate, source), origin); |
523 return v8::ScriptCompiler::CompileModule(isolate, &script_source); | 524 return v8::ScriptCompiler::CompileModule(isolate, &script_source); |
524 } | 525 } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 if (!context->GetExtrasBindingObject() | 764 if (!context->GetExtrasBindingObject() |
764 ->Get(context, V8AtomicString(isolate, name)) | 765 ->Get(context, V8AtomicString(isolate, name)) |
765 .ToLocal(&function_value)) | 766 .ToLocal(&function_value)) |
766 return v8::MaybeLocal<v8::Value>(); | 767 return v8::MaybeLocal<v8::Value>(); |
767 v8::Local<v8::Function> function = function_value.As<v8::Function>(); | 768 v8::Local<v8::Function> function = function_value.As<v8::Function>(); |
768 return V8ScriptRunner::CallInternalFunction(function, v8::Undefined(isolate), | 769 return V8ScriptRunner::CallInternalFunction(function, v8::Undefined(isolate), |
769 num_args, args, isolate); | 770 num_args, args, isolate); |
770 } | 771 } |
771 | 772 |
772 } // namespace blink | 773 } // namespace blink |
OLD | NEW |