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

Side by Side Diff: src/bootstrapper.cc

Issue 879553002: [V8] Added Script::is_debugger_script flag for embedders (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/api.cc ('k') | src/compilation-cache.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/extensions/externalize-string-extension.h" 9 #include "src/extensions/externalize-string-extension.h"
10 #include "src/extensions/free-buffer-extension.h" 10 #include "src/extensions/free-buffer-extension.h"
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 HandleScope scope(isolate); 1441 HandleScope scope(isolate);
1442 Handle<SharedFunctionInfo> function_info; 1442 Handle<SharedFunctionInfo> function_info;
1443 1443
1444 // If we can't find the function in the cache, we compile a new 1444 // If we can't find the function in the cache, we compile a new
1445 // function and insert it into the cache. 1445 // function and insert it into the cache.
1446 if (cache == NULL || !cache->Lookup(name, &function_info)) { 1446 if (cache == NULL || !cache->Lookup(name, &function_info)) {
1447 DCHECK(source->IsOneByteRepresentation()); 1447 DCHECK(source->IsOneByteRepresentation());
1448 Handle<String> script_name = 1448 Handle<String> script_name =
1449 factory->NewStringFromUtf8(name).ToHandleChecked(); 1449 factory->NewStringFromUtf8(name).ToHandleChecked();
1450 function_info = Compiler::CompileScript( 1450 function_info = Compiler::CompileScript(
1451 source, script_name, 0, 0, false, top_context, extension, NULL, 1451 source, script_name, 0, 0, false, false, top_context, extension, NULL,
1452 ScriptCompiler::kNoCompileOptions, 1452 ScriptCompiler::kNoCompileOptions,
1453 use_runtime_context ? NATIVES_CODE : NOT_NATIVES_CODE); 1453 use_runtime_context ? NATIVES_CODE : NOT_NATIVES_CODE);
1454 if (function_info.is_null()) return false; 1454 if (function_info.is_null()) return false;
1455 if (cache != NULL) cache->Add(name, function_info); 1455 if (cache != NULL) cache->Add(name, function_info);
1456 } 1456 }
1457 1457
1458 // Set up the function context. Conceptually, we should clone the 1458 // Set up the function context. Conceptually, we should clone the
1459 // function before overwriting the context but since we're in a 1459 // function before overwriting the context but since we're in a
1460 // single-threaded environment it is not strictly necessary. 1460 // single-threaded environment it is not strictly necessary.
1461 DCHECK(top_context->IsNativeContext()); 1461 DCHECK(top_context->IsNativeContext());
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 // Builtin functions for Script. 1757 // Builtin functions for Script.
1758 Handle<JSFunction> script_fun = InstallFunction( 1758 Handle<JSFunction> script_fun = InstallFunction(
1759 builtins, "Script", JS_VALUE_TYPE, JSValue::kSize, 1759 builtins, "Script", JS_VALUE_TYPE, JSValue::kSize,
1760 isolate()->initial_object_prototype(), Builtins::kIllegal); 1760 isolate()->initial_object_prototype(), Builtins::kIllegal);
1761 Handle<JSObject> prototype = 1761 Handle<JSObject> prototype =
1762 factory()->NewJSObject(isolate()->object_function(), TENURED); 1762 factory()->NewJSObject(isolate()->object_function(), TENURED);
1763 Accessors::FunctionSetPrototype(script_fun, prototype).Assert(); 1763 Accessors::FunctionSetPrototype(script_fun, prototype).Assert();
1764 native_context()->set_script_function(*script_fun); 1764 native_context()->set_script_function(*script_fun);
1765 1765
1766 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); 1766 Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
1767 Map::EnsureDescriptorSlack(script_map, 14); 1767 Map::EnsureDescriptorSlack(script_map, 15);
1768 1768
1769 PropertyAttributes attribs = 1769 PropertyAttributes attribs =
1770 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 1770 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
1771 1771
1772 Handle<AccessorInfo> script_column = 1772 Handle<AccessorInfo> script_column =
1773 Accessors::ScriptColumnOffsetInfo(isolate(), attribs); 1773 Accessors::ScriptColumnOffsetInfo(isolate(), attribs);
1774 { 1774 {
1775 AccessorConstantDescriptor d( 1775 AccessorConstantDescriptor d(
1776 Handle<Name>(Name::cast(script_column->name())), script_column, 1776 Handle<Name>(Name::cast(script_column->name())), script_column,
1777 attribs); 1777 attribs);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 1885
1886 Handle<AccessorInfo> script_source_mapping_url = 1886 Handle<AccessorInfo> script_source_mapping_url =
1887 Accessors::ScriptSourceMappingUrlInfo(isolate(), attribs); 1887 Accessors::ScriptSourceMappingUrlInfo(isolate(), attribs);
1888 { 1888 {
1889 AccessorConstantDescriptor d( 1889 AccessorConstantDescriptor d(
1890 Handle<Name>(Name::cast(script_source_mapping_url->name())), 1890 Handle<Name>(Name::cast(script_source_mapping_url->name())),
1891 script_source_mapping_url, attribs); 1891 script_source_mapping_url, attribs);
1892 script_map->AppendDescriptor(&d); 1892 script_map->AppendDescriptor(&d);
1893 } 1893 }
1894 1894
1895 Handle<AccessorInfo> script_is_embedder_debug_script =
1896 Accessors::ScriptIsEmbedderDebugScriptInfo(isolate(), attribs);
1897 {
1898 AccessorConstantDescriptor d(
1899 Handle<Name>(Name::cast(script_is_embedder_debug_script->name())),
1900 script_is_embedder_debug_script, attribs);
1901 script_map->AppendDescriptor(&d);
1902 }
1903
1895 // Allocate the empty script. 1904 // Allocate the empty script.
1896 Handle<Script> script = factory()->NewScript(factory()->empty_string()); 1905 Handle<Script> script = factory()->NewScript(factory()->empty_string());
1897 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 1906 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
1898 heap()->public_set_empty_script(*script); 1907 heap()->public_set_empty_script(*script);
1899 } 1908 }
1900 { 1909 {
1901 // Builtin function for OpaqueReference -- a JSValue-based object, 1910 // Builtin function for OpaqueReference -- a JSValue-based object,
1902 // that keeps its field isolated from JavaScript code. It may store 1911 // that keeps its field isolated from JavaScript code. It may store
1903 // objects, that JavaScript code may not access. 1912 // objects, that JavaScript code may not access.
1904 Handle<JSFunction> opaque_reference_fun = InstallFunction( 1913 Handle<JSFunction> opaque_reference_fun = InstallFunction(
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
2867 return from + sizeof(NestingCounterType); 2876 return from + sizeof(NestingCounterType);
2868 } 2877 }
2869 2878
2870 2879
2871 // Called when the top-level V8 mutex is destroyed. 2880 // Called when the top-level V8 mutex is destroyed.
2872 void Bootstrapper::FreeThreadResources() { 2881 void Bootstrapper::FreeThreadResources() {
2873 DCHECK(!IsActive()); 2882 DCHECK(!IsActive());
2874 } 2883 }
2875 2884
2876 } } // namespace v8::internal 2885 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/compilation-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698