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

Side by Side Diff: src/api.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, 11 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 } 1543 }
1544 1544
1545 i::Handle<i::String> str = Utils::OpenHandle(*(source->source_string)); 1545 i::Handle<i::String> str = Utils::OpenHandle(*(source->source_string));
1546 LOG_API(isolate, "ScriptCompiler::CompileUnbound"); 1546 LOG_API(isolate, "ScriptCompiler::CompileUnbound");
1547 ENTER_V8(isolate); 1547 ENTER_V8(isolate);
1548 i::SharedFunctionInfo* raw_result = NULL; 1548 i::SharedFunctionInfo* raw_result = NULL;
1549 { i::HandleScope scope(isolate); 1549 { i::HandleScope scope(isolate);
1550 i::Handle<i::Object> name_obj; 1550 i::Handle<i::Object> name_obj;
1551 int line_offset = 0; 1551 int line_offset = 0;
1552 int column_offset = 0; 1552 int column_offset = 0;
1553 bool is_internal_script = false;
1553 bool is_shared_cross_origin = false; 1554 bool is_shared_cross_origin = false;
1554 if (!source->resource_name.IsEmpty()) { 1555 if (!source->resource_name.IsEmpty()) {
1555 name_obj = Utils::OpenHandle(*(source->resource_name)); 1556 name_obj = Utils::OpenHandle(*(source->resource_name));
1556 } 1557 }
1557 if (!source->resource_line_offset.IsEmpty()) { 1558 if (!source->resource_line_offset.IsEmpty()) {
1558 line_offset = static_cast<int>(source->resource_line_offset->Value()); 1559 line_offset = static_cast<int>(source->resource_line_offset->Value());
1559 } 1560 }
1560 if (!source->resource_column_offset.IsEmpty()) { 1561 if (!source->resource_column_offset.IsEmpty()) {
1561 column_offset = 1562 column_offset =
1562 static_cast<int>(source->resource_column_offset->Value()); 1563 static_cast<int>(source->resource_column_offset->Value());
1563 } 1564 }
1564 if (!source->resource_is_shared_cross_origin.IsEmpty()) { 1565 if (!source->resource_is_shared_cross_origin.IsEmpty()) {
1565 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); 1566 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
1566 is_shared_cross_origin = 1567 is_shared_cross_origin =
1567 source->resource_is_shared_cross_origin == v8::True(v8_isolate); 1568 source->resource_is_shared_cross_origin == v8::True(v8_isolate);
1568 } 1569 }
1570 if (!source->resource_is_internal_script.IsEmpty()) {
1571 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
1572 is_internal_script =
1573 source->resource_is_internal_script == v8::True(v8_isolate);
yurys 2015/01/26 15:41:06 source->resource_is_internal_script->IsTrue()
kozy 2015/01/26 16:42:13 Done.
1574 }
1569 EXCEPTION_PREAMBLE(isolate); 1575 EXCEPTION_PREAMBLE(isolate);
1570 i::Handle<i::SharedFunctionInfo> result = i::Compiler::CompileScript( 1576 i::Handle<i::SharedFunctionInfo> result = i::Compiler::CompileScript(
1571 str, name_obj, line_offset, column_offset, is_shared_cross_origin, 1577 str, name_obj, line_offset, column_offset, is_internal_script,
1572 isolate->native_context(), NULL, &script_data, options, 1578 is_shared_cross_origin, isolate->native_context(), NULL, &script_data,
1573 i::NOT_NATIVES_CODE); 1579 options, i::NOT_NATIVES_CODE);
1574 has_pending_exception = result.is_null(); 1580 has_pending_exception = result.is_null();
1575 if (has_pending_exception && script_data != NULL) { 1581 if (has_pending_exception && script_data != NULL) {
1576 // This case won't happen during normal operation; we have compiled 1582 // This case won't happen during normal operation; we have compiled
1577 // successfully and produced cached data, and but the second compilation 1583 // successfully and produced cached data, and but the second compilation
1578 // of the same source code fails. 1584 // of the same source code fails.
1579 delete script_data; 1585 delete script_data;
1580 script_data = NULL; 1586 script_data = NULL;
1581 } 1587 }
1582 EXCEPTION_BAILOUT_CHECK(isolate, Local<UnboundScript>()); 1588 EXCEPTION_BAILOUT_CHECK(isolate, Local<UnboundScript>());
1583 raw_result = *result; 1589 raw_result = *result;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 static_cast<int>(origin.ResourceLineOffset()->Value()))); 1650 static_cast<int>(origin.ResourceLineOffset()->Value())));
1645 } 1651 }
1646 if (!origin.ResourceColumnOffset().IsEmpty()) { 1652 if (!origin.ResourceColumnOffset().IsEmpty()) {
1647 script->set_column_offset(i::Smi::FromInt( 1653 script->set_column_offset(i::Smi::FromInt(
1648 static_cast<int>(origin.ResourceColumnOffset()->Value()))); 1654 static_cast<int>(origin.ResourceColumnOffset()->Value())));
1649 } 1655 }
1650 if (!origin.ResourceIsSharedCrossOrigin().IsEmpty()) { 1656 if (!origin.ResourceIsSharedCrossOrigin().IsEmpty()) {
1651 script->set_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin() == 1657 script->set_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin() ==
1652 v8::True(v8_isolate)); 1658 v8::True(v8_isolate));
1653 } 1659 }
1660 if (!origin.ResourceIsInternalScript().IsEmpty()) {
1661 script->set_is_internal_script(origin.ResourceIsInternalScript() ==
yurys 2015/01/26 15:41:06 ditto
1662 v8::True(v8_isolate));
1663 }
1654 source->info->set_script(script); 1664 source->info->set_script(script);
1655 source->info->SetContext(isolate->native_context()); 1665 source->info->SetContext(isolate->native_context());
1656 1666
1657 EXCEPTION_PREAMBLE(isolate); 1667 EXCEPTION_PREAMBLE(isolate);
1658 1668
1659 // Do the parsing tasks which need to be done on the main thread. This will 1669 // Do the parsing tasks which need to be done on the main thread. This will
1660 // also handle parse errors. 1670 // also handle parse errors.
1661 source->parser->Internalize(); 1671 source->parser->Internalize();
1662 source->parser->HandleSourceURLComments(); 1672 source->parser->HandleSourceURLComments();
1663 1673
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 i::Handle<i::JSValue> script_value = 1917 i::Handle<i::JSValue> script_value =
1908 i::Handle<i::JSValue>::cast(script_wraper); 1918 i::Handle<i::JSValue>::cast(script_wraper);
1909 i::Handle<i::Script> script(i::Script::cast(script_value->value())); 1919 i::Handle<i::Script> script(i::Script::cast(script_value->value()));
1910 i::Handle<i::Object> scriptName(i::Script::GetNameOrSourceURL(script)); 1920 i::Handle<i::Object> scriptName(i::Script::GetNameOrSourceURL(script));
1911 v8::Isolate* v8_isolate = 1921 v8::Isolate* v8_isolate =
1912 reinterpret_cast<v8::Isolate*>(script->GetIsolate()); 1922 reinterpret_cast<v8::Isolate*>(script->GetIsolate());
1913 v8::ScriptOrigin origin( 1923 v8::ScriptOrigin origin(
1914 Utils::ToLocal(scriptName), 1924 Utils::ToLocal(scriptName),
1915 v8::Integer::New(v8_isolate, script->line_offset()->value()), 1925 v8::Integer::New(v8_isolate, script->line_offset()->value()),
1916 v8::Integer::New(v8_isolate, script->column_offset()->value()), 1926 v8::Integer::New(v8_isolate, script->column_offset()->value()),
1917 Handle<Boolean>(), 1927 v8::Boolean::New(v8_isolate, script->is_shared_cross_origin()),
1918 v8::Integer::New(v8_isolate, script->id()->value())); 1928 v8::Integer::New(v8_isolate, script->id()->value()),
1929 v8::Boolean::New(v8_isolate, script->is_internal_script()));
1919 return origin; 1930 return origin;
1920 } 1931 }
1921 1932
1922 1933
1923 v8::Handle<Value> Message::GetScriptResourceName() const { 1934 v8::Handle<Value> Message::GetScriptResourceName() const {
1924 return GetScriptOrigin().ResourceName(); 1935 return GetScriptOrigin().ResourceName();
1925 } 1936 }
1926 1937
1927 1938
1928 v8::Handle<v8::StackTrace> Message::GetStackTrace() const { 1939 v8::Handle<v8::StackTrace> Message::GetStackTrace() const {
(...skipping 5676 matching lines...) Expand 10 before | Expand all | Expand 10 after
7605 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7616 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7606 Address callback_address = 7617 Address callback_address =
7607 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7618 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7608 VMState<EXTERNAL> state(isolate); 7619 VMState<EXTERNAL> state(isolate);
7609 ExternalCallbackScope call_scope(isolate, callback_address); 7620 ExternalCallbackScope call_scope(isolate, callback_address);
7610 callback(info); 7621 callback(info);
7611 } 7622 }
7612 7623
7613 7624
7614 } } // namespace v8::internal 7625 } } // namespace v8::internal
OLDNEW
« include/v8.h ('K') | « src/accessors.cc ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698