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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return StartupData::kUncompressed; | 391 return StartupData::kUncompressed; |
392 #endif | 392 #endif |
393 } | 393 } |
394 | 394 |
395 | 395 |
396 enum CompressedStartupDataItems { | 396 enum CompressedStartupDataItems { |
397 kSnapshot = 0, | 397 kSnapshot = 0, |
398 kSnapshotContext, | 398 kSnapshotContext, |
399 kLibraries, | 399 kLibraries, |
400 kExperimentalLibraries, | 400 kExperimentalLibraries, |
401 #if defined(ENABLE_I18N_SUPPORT) | 401 #if defined(V8_I18N_SUPPORT) |
402 kI18NExtension, | 402 kI18NExtension, |
403 #endif | 403 #endif |
404 kCompressedStartupDataCount | 404 kCompressedStartupDataCount |
405 }; | 405 }; |
406 | 406 |
407 | 407 |
408 int V8::GetCompressedStartupDataCount() { | 408 int V8::GetCompressedStartupDataCount() { |
409 #ifdef COMPRESS_STARTUP_DATA_BZ2 | 409 #ifdef COMPRESS_STARTUP_DATA_BZ2 |
410 return kCompressedStartupDataCount; | 410 return kCompressedStartupDataCount; |
411 #else | 411 #else |
(...skipping 23 matching lines...) Expand all Loading... |
435 | 435 |
436 i::Vector<const i::byte> exp_libraries_source = | 436 i::Vector<const i::byte> exp_libraries_source = |
437 i::ExperimentalNatives::GetScriptsSource(); | 437 i::ExperimentalNatives::GetScriptsSource(); |
438 compressed_data[kExperimentalLibraries].data = | 438 compressed_data[kExperimentalLibraries].data = |
439 reinterpret_cast<const char*>(exp_libraries_source.start()); | 439 reinterpret_cast<const char*>(exp_libraries_source.start()); |
440 compressed_data[kExperimentalLibraries].compressed_size = | 440 compressed_data[kExperimentalLibraries].compressed_size = |
441 exp_libraries_source.length(); | 441 exp_libraries_source.length(); |
442 compressed_data[kExperimentalLibraries].raw_size = | 442 compressed_data[kExperimentalLibraries].raw_size = |
443 i::ExperimentalNatives::GetRawScriptsSize(); | 443 i::ExperimentalNatives::GetRawScriptsSize(); |
444 | 444 |
445 #if defined(ENABLE_I18N_SUPPORT) | 445 #if defined(V8_I18N_SUPPORT) |
446 i::Vector<const ii:byte> i18n_extension_source = | 446 i::Vector<const ii:byte> i18n_extension_source = |
447 i::I18NNatives::GetScriptsSource(); | 447 i::I18NNatives::GetScriptsSource(); |
448 compressed_data[kI18NExtension].data = | 448 compressed_data[kI18NExtension].data = |
449 reinterpret_cast<const char*>(i18n_extension_source.start()); | 449 reinterpret_cast<const char*>(i18n_extension_source.start()); |
450 compressed_data[kI18NExtension].compressed_size = | 450 compressed_data[kI18NExtension].compressed_size = |
451 i18n_extension_source.length(); | 451 i18n_extension_source.length(); |
452 compressed_data[kI18NExtension].raw_size = | 452 compressed_data[kI18NExtension].raw_size = |
453 i::I18NNatives::GetRawScriptsSize(); | 453 i::I18NNatives::GetRawScriptsSize(); |
454 #endif | 454 #endif |
455 #endif | 455 #endif |
(...skipping 19 matching lines...) Expand all Loading... |
475 decompressed_data[kLibraries].raw_size); | 475 decompressed_data[kLibraries].raw_size); |
476 i::Natives::SetRawScriptsSource(libraries_source); | 476 i::Natives::SetRawScriptsSource(libraries_source); |
477 | 477 |
478 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), | 478 ASSERT_EQ(i::ExperimentalNatives::GetRawScriptsSize(), |
479 decompressed_data[kExperimentalLibraries].raw_size); | 479 decompressed_data[kExperimentalLibraries].raw_size); |
480 i::Vector<const char> exp_libraries_source( | 480 i::Vector<const char> exp_libraries_source( |
481 decompressed_data[kExperimentalLibraries].data, | 481 decompressed_data[kExperimentalLibraries].data, |
482 decompressed_data[kExperimentalLibraries].raw_size); | 482 decompressed_data[kExperimentalLibraries].raw_size); |
483 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); | 483 i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); |
484 | 484 |
485 #if defined(ENABLE_I18N_SUPPORT) | 485 #if defined(V8_I18N_SUPPORT) |
486 ASSERT_EQ(i::I18NNatives::GetRawScriptsSize(), | 486 ASSERT_EQ(i::I18NNatives::GetRawScriptsSize(), |
487 decompressed_data[kI18NExtension].raw_size); | 487 decompressed_data[kI18NExtension].raw_size); |
488 i::Vector<const char> i18n_extension_source( | 488 i::Vector<const char> i18n_extension_source( |
489 decompressed_data[kI18NExtension].data, | 489 decompressed_data[kI18NExtension].data, |
490 decompressed_data[kI18NExtension].raw_size); | 490 decompressed_data[kI18NExtension].raw_size); |
491 i::I18NNatives::SetRawScriptsSource(i18n_extension_source); | 491 i::I18NNatives::SetRawScriptsSource(i18n_extension_source); |
492 #endif | 492 #endif |
493 #endif | 493 #endif |
494 } | 494 } |
495 | 495 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 if (!ApiCheck(isolate->handle_scope_implementer()->LeaveLastContext(), | 763 if (!ApiCheck(isolate->handle_scope_implementer()->LeaveLastContext(), |
764 "v8::Context::Exit()", | 764 "v8::Context::Exit()", |
765 "Cannot exit non-entered context")) { | 765 "Cannot exit non-entered context")) { |
766 return; | 766 return; |
767 } | 767 } |
768 | 768 |
769 // Content of 'last_context' could be NULL. | 769 // Content of 'last_context' could be NULL. |
770 i::Context* last_context = | 770 i::Context* last_context = |
771 isolate->handle_scope_implementer()->RestoreContext(); | 771 isolate->handle_scope_implementer()->RestoreContext(); |
772 isolate->set_context(last_context); | 772 isolate->set_context(last_context); |
| 773 isolate->set_context_exit_happened(true); |
773 } | 774 } |
774 | 775 |
775 | 776 |
776 static void* DecodeSmiToAligned(i::Object* value, const char* location) { | 777 static void* DecodeSmiToAligned(i::Object* value, const char* location) { |
777 ApiCheck(value->IsSmi(), location, "Not a Smi"); | 778 ApiCheck(value->IsSmi(), location, "Not a Smi"); |
778 return reinterpret_cast<void*>(value); | 779 return reinterpret_cast<void*>(value); |
779 } | 780 } |
780 | 781 |
781 | 782 |
782 static i::Smi* EncodeAlignedAsSmi(void* value, const char* location) { | 783 static i::Smi* EncodeAlignedAsSmi(void* value, const char* location) { |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 i::Isolate* isolate = i::Isolate::Current(); | 1911 i::Isolate* isolate = i::Isolate::Current(); |
1911 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); | 1912 ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>()); |
1912 LOG_API(isolate, "Script::New"); | 1913 LOG_API(isolate, "Script::New"); |
1913 ENTER_V8(isolate); | 1914 ENTER_V8(isolate); |
1914 i::SharedFunctionInfo* raw_result = NULL; | 1915 i::SharedFunctionInfo* raw_result = NULL; |
1915 { i::HandleScope scope(isolate); | 1916 { i::HandleScope scope(isolate); |
1916 i::Handle<i::String> str = Utils::OpenHandle(*source); | 1917 i::Handle<i::String> str = Utils::OpenHandle(*source); |
1917 i::Handle<i::Object> name_obj; | 1918 i::Handle<i::Object> name_obj; |
1918 int line_offset = 0; | 1919 int line_offset = 0; |
1919 int column_offset = 0; | 1920 int column_offset = 0; |
| 1921 bool is_shared_cross_origin = false; |
1920 if (origin != NULL) { | 1922 if (origin != NULL) { |
1921 if (!origin->ResourceName().IsEmpty()) { | 1923 if (!origin->ResourceName().IsEmpty()) { |
1922 name_obj = Utils::OpenHandle(*origin->ResourceName()); | 1924 name_obj = Utils::OpenHandle(*origin->ResourceName()); |
1923 } | 1925 } |
1924 if (!origin->ResourceLineOffset().IsEmpty()) { | 1926 if (!origin->ResourceLineOffset().IsEmpty()) { |
1925 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); | 1927 line_offset = static_cast<int>(origin->ResourceLineOffset()->Value()); |
1926 } | 1928 } |
1927 if (!origin->ResourceColumnOffset().IsEmpty()) { | 1929 if (!origin->ResourceColumnOffset().IsEmpty()) { |
1928 column_offset = | 1930 column_offset = |
1929 static_cast<int>(origin->ResourceColumnOffset()->Value()); | 1931 static_cast<int>(origin->ResourceColumnOffset()->Value()); |
1930 } | 1932 } |
| 1933 if (!origin->ResourceIsSharedCrossOrigin().IsEmpty()) { |
| 1934 is_shared_cross_origin = |
| 1935 origin->ResourceIsSharedCrossOrigin() == v8::True(); |
| 1936 } |
1931 } | 1937 } |
1932 EXCEPTION_PREAMBLE(isolate); | 1938 EXCEPTION_PREAMBLE(isolate); |
1933 i::ScriptDataImpl* pre_data_impl = | 1939 i::ScriptDataImpl* pre_data_impl = |
1934 static_cast<i::ScriptDataImpl*>(pre_data); | 1940 static_cast<i::ScriptDataImpl*>(pre_data); |
1935 // 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 |
1936 // 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. |
1937 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); | 1943 ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); |
1938 // If the pre-data isn't sane we simply ignore it | 1944 // If the pre-data isn't sane we simply ignore it |
1939 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { | 1945 if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { |
1940 pre_data_impl = NULL; | 1946 pre_data_impl = NULL; |
1941 } | 1947 } |
1942 i::Handle<i::SharedFunctionInfo> result = | 1948 i::Handle<i::SharedFunctionInfo> result = |
1943 i::Compiler::Compile(str, | 1949 i::Compiler::Compile(str, |
1944 name_obj, | 1950 name_obj, |
1945 line_offset, | 1951 line_offset, |
1946 column_offset, | 1952 column_offset, |
| 1953 is_shared_cross_origin, |
1947 isolate->global_context(), | 1954 isolate->global_context(), |
1948 NULL, | 1955 NULL, |
1949 pre_data_impl, | 1956 pre_data_impl, |
1950 Utils::OpenHandle(*script_data, true), | 1957 Utils::OpenHandle(*script_data, true), |
1951 i::NOT_NATIVES_CODE); | 1958 i::NOT_NATIVES_CODE); |
1952 has_pending_exception = result.is_null(); | 1959 has_pending_exception = result.is_null(); |
1953 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); | 1960 EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>()); |
1954 raw_result = *result; | 1961 raw_result = *result; |
1955 } | 1962 } |
1956 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... |
2404 &has_pending_exception); | 2411 &has_pending_exception); |
2405 EXCEPTION_BAILOUT_CHECK(isolate, 0); | 2412 EXCEPTION_BAILOUT_CHECK(isolate, 0); |
2406 i::Handle<i::JSMessageObject> message = | 2413 i::Handle<i::JSMessageObject> message = |
2407 i::Handle<i::JSMessageObject>::cast(data_obj); | 2414 i::Handle<i::JSMessageObject>::cast(data_obj); |
2408 int start = message->start_position(); | 2415 int start = message->start_position(); |
2409 int end = message->end_position(); | 2416 int end = message->end_position(); |
2410 return static_cast<int>(start_col_obj->Number()) + (end - start); | 2417 return static_cast<int>(start_col_obj->Number()) + (end - start); |
2411 } | 2418 } |
2412 | 2419 |
2413 | 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 |
2414 Local<String> Message::GetSourceLine() const { | 2435 Local<String> Message::GetSourceLine() const { |
2415 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2436 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
2416 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>()); | 2437 ON_BAILOUT(isolate, "v8::Message::GetSourceLine()", return Local<String>()); |
2417 ENTER_V8(isolate); | 2438 ENTER_V8(isolate); |
2418 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); | 2439 HandleScope scope(reinterpret_cast<Isolate*>(isolate)); |
2419 EXCEPTION_PREAMBLE(isolate); | 2440 EXCEPTION_PREAMBLE(isolate); |
2420 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine", | 2441 i::Handle<i::Object> result = CallV8HeapFunction("GetSourceLine", |
2421 Utils::OpenHandle(this), | 2442 Utils::OpenHandle(this), |
2422 &has_pending_exception); | 2443 &has_pending_exception); |
2423 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>()); | 2444 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::String>()); |
(...skipping 3652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6076 i::Isolate* isolate = i::Isolate::Current(); | 6097 i::Isolate* isolate = i::Isolate::Current(); |
6077 EnsureInitializedForIsolate(isolate, "v8::NumberObject::New()"); | 6098 EnsureInitializedForIsolate(isolate, "v8::NumberObject::New()"); |
6078 LOG_API(isolate, "NumberObject::New"); | 6099 LOG_API(isolate, "NumberObject::New"); |
6079 ENTER_V8(isolate); | 6100 ENTER_V8(isolate); |
6080 i::Handle<i::Object> number = isolate->factory()->NewNumber(value); | 6101 i::Handle<i::Object> number = isolate->factory()->NewNumber(value); |
6081 i::Handle<i::Object> obj = isolate->factory()->ToObject(number); | 6102 i::Handle<i::Object> obj = isolate->factory()->ToObject(number); |
6082 return Utils::ToLocal(obj); | 6103 return Utils::ToLocal(obj); |
6083 } | 6104 } |
6084 | 6105 |
6085 | 6106 |
6086 double v8::NumberObject::NumberValue() const { | 6107 double v8::NumberObject::ValueOf() const { |
6087 i::Isolate* isolate = i::Isolate::Current(); | 6108 i::Isolate* isolate = i::Isolate::Current(); |
6088 if (IsDeadCheck(isolate, "v8::NumberObject::NumberValue()")) return 0; | 6109 if (IsDeadCheck(isolate, "v8::NumberObject::NumberValue()")) return 0; |
6089 LOG_API(isolate, "NumberObject::NumberValue"); | 6110 LOG_API(isolate, "NumberObject::NumberValue"); |
6090 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 6111 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
6091 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); | 6112 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
6092 return jsvalue->value()->Number(); | 6113 return jsvalue->value()->Number(); |
6093 } | 6114 } |
6094 | 6115 |
6095 | 6116 |
6096 Local<v8::Value> v8::BooleanObject::New(bool value) { | 6117 Local<v8::Value> v8::BooleanObject::New(bool value) { |
6097 i::Isolate* isolate = i::Isolate::Current(); | 6118 i::Isolate* isolate = i::Isolate::Current(); |
6098 EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()"); | 6119 EnsureInitializedForIsolate(isolate, "v8::BooleanObject::New()"); |
6099 LOG_API(isolate, "BooleanObject::New"); | 6120 LOG_API(isolate, "BooleanObject::New"); |
6100 ENTER_V8(isolate); | 6121 ENTER_V8(isolate); |
6101 i::Handle<i::Object> boolean(value | 6122 i::Handle<i::Object> boolean(value |
6102 ? isolate->heap()->true_value() | 6123 ? isolate->heap()->true_value() |
6103 : isolate->heap()->false_value(), | 6124 : isolate->heap()->false_value(), |
6104 isolate); | 6125 isolate); |
6105 i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean); | 6126 i::Handle<i::Object> obj = isolate->factory()->ToObject(boolean); |
6106 return Utils::ToLocal(obj); | 6127 return Utils::ToLocal(obj); |
6107 } | 6128 } |
6108 | 6129 |
6109 | 6130 |
6110 bool v8::BooleanObject::BooleanValue() const { | 6131 bool v8::BooleanObject::ValueOf() const { |
6111 i::Isolate* isolate = i::Isolate::Current(); | 6132 i::Isolate* isolate = i::Isolate::Current(); |
6112 if (IsDeadCheck(isolate, "v8::BooleanObject::BooleanValue()")) return 0; | 6133 if (IsDeadCheck(isolate, "v8::BooleanObject::BooleanValue()")) return 0; |
6113 LOG_API(isolate, "BooleanObject::BooleanValue"); | 6134 LOG_API(isolate, "BooleanObject::BooleanValue"); |
6114 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 6135 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
6115 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); | 6136 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
6116 return jsvalue->value()->IsTrue(); | 6137 return jsvalue->value()->IsTrue(); |
6117 } | 6138 } |
6118 | 6139 |
6119 | 6140 |
6120 Local<v8::Value> v8::StringObject::New(Handle<String> value) { | 6141 Local<v8::Value> v8::StringObject::New(Handle<String> value) { |
6121 i::Isolate* isolate = i::Isolate::Current(); | 6142 i::Isolate* isolate = i::Isolate::Current(); |
6122 EnsureInitializedForIsolate(isolate, "v8::StringObject::New()"); | 6143 EnsureInitializedForIsolate(isolate, "v8::StringObject::New()"); |
6123 LOG_API(isolate, "StringObject::New"); | 6144 LOG_API(isolate, "StringObject::New"); |
6124 ENTER_V8(isolate); | 6145 ENTER_V8(isolate); |
6125 i::Handle<i::Object> obj = | 6146 i::Handle<i::Object> obj = |
6126 isolate->factory()->ToObject(Utils::OpenHandle(*value)); | 6147 isolate->factory()->ToObject(Utils::OpenHandle(*value)); |
6127 return Utils::ToLocal(obj); | 6148 return Utils::ToLocal(obj); |
6128 } | 6149 } |
6129 | 6150 |
6130 | 6151 |
6131 Local<v8::String> v8::StringObject::StringValue() const { | 6152 Local<v8::String> v8::StringObject::ValueOf() const { |
6132 i::Isolate* isolate = i::Isolate::Current(); | 6153 i::Isolate* isolate = i::Isolate::Current(); |
6133 if (IsDeadCheck(isolate, "v8::StringObject::StringValue()")) { | 6154 if (IsDeadCheck(isolate, "v8::StringObject::StringValue()")) { |
6134 return Local<v8::String>(); | 6155 return Local<v8::String>(); |
6135 } | 6156 } |
6136 LOG_API(isolate, "StringObject::StringValue"); | 6157 LOG_API(isolate, "StringObject::StringValue"); |
6137 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 6158 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
6138 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); | 6159 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
6139 return Utils::ToLocal( | 6160 return Utils::ToLocal( |
6140 i::Handle<i::String>(i::String::cast(jsvalue->value()))); | 6161 i::Handle<i::String>(i::String::cast(jsvalue->value()))); |
6141 } | 6162 } |
6142 | 6163 |
6143 | 6164 |
6144 Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Handle<Symbol> value) { | 6165 Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Handle<Symbol> value) { |
6145 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6166 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6146 EnsureInitializedForIsolate(i_isolate, "v8::SymbolObject::New()"); | 6167 EnsureInitializedForIsolate(i_isolate, "v8::SymbolObject::New()"); |
6147 LOG_API(i_isolate, "SymbolObject::New"); | 6168 LOG_API(i_isolate, "SymbolObject::New"); |
6148 ENTER_V8(i_isolate); | 6169 ENTER_V8(i_isolate); |
6149 i::Handle<i::Object> obj = | 6170 i::Handle<i::Object> obj = |
6150 i_isolate->factory()->ToObject(Utils::OpenHandle(*value)); | 6171 i_isolate->factory()->ToObject(Utils::OpenHandle(*value)); |
6151 return Utils::ToLocal(obj); | 6172 return Utils::ToLocal(obj); |
6152 } | 6173 } |
6153 | 6174 |
6154 | 6175 |
6155 Local<v8::Symbol> v8::SymbolObject::SymbolValue() const { | 6176 Local<v8::Symbol> v8::SymbolObject::ValueOf() const { |
6156 i::Isolate* isolate = i::Isolate::Current(); | 6177 i::Isolate* isolate = i::Isolate::Current(); |
6157 if (IsDeadCheck(isolate, "v8::SymbolObject::SymbolValue()")) | 6178 if (IsDeadCheck(isolate, "v8::SymbolObject::SymbolValue()")) |
6158 return Local<v8::Symbol>(); | 6179 return Local<v8::Symbol>(); |
6159 LOG_API(isolate, "SymbolObject::SymbolValue"); | 6180 LOG_API(isolate, "SymbolObject::SymbolValue"); |
6160 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 6181 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
6161 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); | 6182 i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj); |
6162 return Utils::ToLocal( | 6183 return Utils::ToLocal( |
6163 i::Handle<i::Symbol>(i::Symbol::cast(jsvalue->value()))); | 6184 i::Handle<i::Symbol>(i::Symbol::cast(jsvalue->value()))); |
6164 } | 6185 } |
6165 | 6186 |
6166 | 6187 |
6167 Local<v8::Value> v8::Date::New(double time) { | 6188 Local<v8::Value> v8::Date::New(double time) { |
6168 i::Isolate* isolate = i::Isolate::Current(); | 6189 i::Isolate* isolate = i::Isolate::Current(); |
6169 EnsureInitializedForIsolate(isolate, "v8::Date::New()"); | 6190 EnsureInitializedForIsolate(isolate, "v8::Date::New()"); |
6170 LOG_API(isolate, "Date::New"); | 6191 LOG_API(isolate, "Date::New"); |
6171 if (std::isnan(time)) { | 6192 if (std::isnan(time)) { |
6172 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. | 6193 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. |
6173 time = i::OS::nan_value(); | 6194 time = i::OS::nan_value(); |
6174 } | 6195 } |
6175 ENTER_V8(isolate); | 6196 ENTER_V8(isolate); |
6176 EXCEPTION_PREAMBLE(isolate); | 6197 EXCEPTION_PREAMBLE(isolate); |
6177 i::Handle<i::Object> obj = | 6198 i::Handle<i::Object> obj = |
6178 i::Execution::NewDate(time, &has_pending_exception); | 6199 i::Execution::NewDate(time, &has_pending_exception); |
6179 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Value>()); | 6200 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Value>()); |
6180 return Utils::ToLocal(obj); | 6201 return Utils::ToLocal(obj); |
6181 } | 6202 } |
6182 | 6203 |
6183 | 6204 |
6184 double v8::Date::NumberValue() const { | 6205 double v8::Date::ValueOf() const { |
6185 i::Isolate* isolate = i::Isolate::Current(); | 6206 i::Isolate* isolate = i::Isolate::Current(); |
6186 if (IsDeadCheck(isolate, "v8::Date::NumberValue()")) return 0; | 6207 if (IsDeadCheck(isolate, "v8::Date::NumberValue()")) return 0; |
6187 LOG_API(isolate, "Date::NumberValue"); | 6208 LOG_API(isolate, "Date::NumberValue"); |
6188 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 6209 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
6189 i::Handle<i::JSDate> jsdate = i::Handle<i::JSDate>::cast(obj); | 6210 i::Handle<i::JSDate> jsdate = i::Handle<i::JSDate>::cast(obj); |
6190 return jsdate->value()->Number(); | 6211 return jsdate->value()->Number(); |
6191 } | 6212 } |
6192 | 6213 |
6193 | 6214 |
6194 void v8::Date::DateTimeConfigurationChangeNotification() { | 6215 void v8::Date::DateTimeConfigurationChangeNotification() { |
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8097 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8118 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8098 Address callback_address = | 8119 Address callback_address = |
8099 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8120 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8100 VMState<EXTERNAL> state(isolate); | 8121 VMState<EXTERNAL> state(isolate); |
8101 ExternalCallbackScope call_scope(isolate, callback_address); | 8122 ExternalCallbackScope call_scope(isolate, callback_address); |
8102 return callback(info); | 8123 return callback(info); |
8103 } | 8124 } |
8104 | 8125 |
8105 | 8126 |
8106 } } // namespace v8::internal | 8127 } } // namespace v8::internal |
OLD | NEW |