| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1911 i::Isolate* isolate = i::Isolate::Current(); | 1911 i::Isolate* isolate = i::Isolate::Current(); |
| 1912 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); | 1912 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); |
| 1913 LOG_API(isolate, "Script::New"); | 1913 LOG_API(isolate, "Script::New"); |
| 1914 ENTER_V8(isolate); | 1914 ENTER_V8(isolate); |
| 1915 i::SharedFunctionInfo* raw_result = NULL; | 1915 i::SharedFunctionInfo* raw_result = NULL; |
| 1916 { i::HandleScope scope(isolate); | 1916 { i::HandleScope scope(isolate); |
| 1917 i::Handle<i::String> str = Utils::OpenHandle(*source); | 1917 i::Handle<i::String> str = Utils::OpenHandle(*source); |
| 1918 i::Handle<i::Object> name_obj; | 1918 i::Handle<i::Object> name_obj; |
| 1919 int line_offset = 0; | 1919 int line_offset = 0; |
| 1920 int column_offset = 0; | 1920 int column_offset = 0; |
| 1921 bool is_shared_cross_origin = false; |
| 1921 if (origin != NULL) { | 1922 if (origin != NULL) { |
| 1922 if (!origin->ResourceName().IsEmpty()) { | 1923 if (!origin->ResourceName().IsEmpty()) { |
| 1923 name_obj = Utils::OpenHandle(*origin->ResourceName()); | 1924 name_obj = Utils::OpenHandle(*origin->ResourceName()); |
| 1924 } | 1925 } |
| 1925 if (!origin->ResourceLineOffset().IsEmpty()) { | 1926 if (!origin->ResourceLineOffset().IsEmpty()) { |
| 1926 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); | 1927 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); |
| 1927 } | 1928 } |
| 1928 if (!origin->ResourceColumnOffset().IsEmpty()) { | 1929 if (!origin->ResourceColumnOffset().IsEmpty()) { |
| 1929 column_offset = | 1930 column_offset = |
| 1930 static_cast<int>(origin->ResourceColumnOffset()->Value()); | 1931 static_cast<int>(origin->ResourceColumnOffset()->Value()); |
| 1931 } | 1932 } |
| 1933 if (!origin->ResourceIsSharedCrossOrigin().IsEmpty()) { |
| 1934 is_shared_cross_origin = |
| 1935 origin->ResourceIsSharedCrossOrigin() == v8::True(); |
| 1936 } |
| 1932 } | 1937 } |
| 1933 EXCEPTION_PREAMBLE(isolate); | 1938 EXCEPTION_PREAMBLE(isolate); |
| 1934 i::ScriptDataImpl* pre_data_impl = | 1939 i::ScriptDataImpl* pre_data_impl = |
| 1935 static_cast<i::ScriptDataImpl*>(pre_data); | 1940 static_cast<i::ScriptDataImpl*>(pre_data); |
| 1936 // We assert that the pre-data is sane, even though we can actually | 1941 // We assert that the pre-data is sane, even though we can actually |
| 1937 // handle it if it turns out not to be in release mode. | 1942 // handle it if it turns out not to be in release mode. |
| 1938 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); | 1943 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); |
| 1939 // If the pre-data isn't sane we simply ignore it | 1944 // If the pre-data isn't sane we simply ignore it |
| 1940 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { | 1945 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { |
| 1941 pre_data_impl = NULL; | 1946 pre_data_impl = NULL; |
| 1942 } | 1947 } |
| 1943 i::Handle<i::SharedFunctionInfo> result = | 1948 i::Handle<i::SharedFunctionInfo> result = |
| 1944 i::Compiler::Compile(str, | 1949 i::Compiler::Compile(str, |
| 1945 name_obj, | 1950 name_obj, |
| 1946 line_offset, | 1951 line_offset, |
| 1947 column_offset, | 1952 column_offset, |
| 1953 is_shared_cross_origin, |
| 1948 isolate->global_context(), | 1954 isolate->global_context(), |
| 1949 NULL, | 1955 NULL, |
| 1950 pre_data_impl, | 1956 pre_data_impl, |
| 1951 Utils::OpenHandle(*script_data, true), | 1957 Utils::OpenHandle(*script_data, true), |
| 1952 i::NOT_NATIVES_CODE); | 1958 i::NOT_NATIVES_CODE); |
| 1953 has_pending_exception = result.is_null(); | 1959 has_pending_exception = result.is_null(); |
| 1954 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); | 1960 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); |
| 1955 raw_result = *result; | 1961 raw_result = *result; |
| 1956 } | 1962 } |
| 1957 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); | 1963 i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2405 &has_pending_exception); | 2411 &has_pending_exception); |
| 2406 EXCEPTION_BAILOUT_CHECK(isolate, 0); | 2412 EXCEPTION_BAILOUT_CHECK(isolate, 0); |
| 2407 i::Handle<i::JSMessageObject> message = | 2413 i::Handle<i::JSMessageObject> message = |
| 2408 i::Handle<i::JSMessageObject>::cast(data_obj); | 2414 i::Handle<i::JSMessageObject>::cast(data_obj); |
| 2409 int start = message->start_position(); | 2415 int start = message->start_position(); |
| 2410 int end = message->end_position(); | 2416 int end = message->end_position(); |
| 2411 return static_cast<int>(start_col_obj->Number()) + (end - start); | 2417 return static_cast<int>(start_col_obj->Number()) + (end - start); |
| 2412 } | 2418 } |
| 2413 | 2419 |
| 2414 | 2420 |
| 2421 bool Message::IsSharedCrossOrigin() const { |
| 2422 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2423 if (IsDeadCheck(isolate, "v8::Message::IsSharedCrossOrigin()")) return 0; |
| 2424 ENTER_V8(isolate); |
| 2425 i::HandleScope scope(isolate); |
| 2426 i::Handle<i::JSMessageObject> message = |
| 2427 i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this)); |
| 2428 i::Handle<i::JSValue> script = |
| 2429 i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(), |
| 2430 isolate)); |
| 2431 return i::Script::cast(script->value())->is_shared_cross_origin(); |
| 2432 } |
| 2433 |
| 2434 |
| 2415 Local<String> Message::GetSourceLine() const { | 2435 Local<String> Message::GetSourceLine() const { |
| 2416 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2436 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2417 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>()); | 2437 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>()); |
| 2418 ENTER_V8(isolate); | 2438 ENTER_V8(isolate); |
| 2419 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 2439 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); |
| 2420 EXCEPTION_PREAMBLE(isolate); | 2440 EXCEPTION_PREAMBLE(isolate); |
| 2421 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine", | 2441 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine", |
| 2422 Utils::OpenHandle(this), | 2442 Utils::OpenHandle(this), |
| 2423 &has_pending_exception); | 2443 &has_pending_exception); |
| 2424 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>()); | 2444 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>()); |
| (...skipping 5673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8098 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8118 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8099 Address callback_address = | 8119 Address callback_address = |
| 8100 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8120 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8101 VMState<EXTERNAL> state(isolate); | 8121 VMState<EXTERNAL> state(isolate); |
| 8102 ExternalCallbackScope call_scope(isolate, callback_address); | 8122 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8103 return callback(info); | 8123 return callback(info); |
| 8104 } | 8124 } |
| 8105 | 8125 |
| 8106 | 8126 |
| 8107 } } // namespace v8::internal | 8127 } } // namespace v8::internal |
| OLD | NEW |