OLD | NEW |
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 2717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2728 i::Handle<i::Object> num; | 2728 i::Handle<i::Object> num; |
2729 if (obj->IsNumber()) { | 2729 if (obj->IsNumber()) { |
2730 num = obj; | 2730 num = obj; |
2731 } else { | 2731 } else { |
2732 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); | 2732 i::Isolate* isolate = i::HeapObject::cast(*obj)->GetIsolate(); |
2733 LOG_API(isolate, "NumberValue"); | 2733 LOG_API(isolate, "NumberValue"); |
2734 ENTER_V8(isolate); | 2734 ENTER_V8(isolate); |
2735 EXCEPTION_PREAMBLE(isolate); | 2735 EXCEPTION_PREAMBLE(isolate); |
2736 has_pending_exception = !i::Execution::ToNumber( | 2736 has_pending_exception = !i::Execution::ToNumber( |
2737 isolate, obj).ToHandle(&num); | 2737 isolate, obj).ToHandle(&num); |
2738 EXCEPTION_BAILOUT_CHECK(isolate, base::OS::nan_value()); | 2738 EXCEPTION_BAILOUT_CHECK(isolate, std::numeric_limits<double>::quiet_NaN()); |
2739 } | 2739 } |
2740 return num->Number(); | 2740 return num->Number(); |
2741 } | 2741 } |
2742 | 2742 |
2743 | 2743 |
2744 int64_t Value::IntegerValue() const { | 2744 int64_t Value::IntegerValue() const { |
2745 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2745 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
2746 i::Handle<i::Object> num; | 2746 i::Handle<i::Object> num; |
2747 if (obj->IsNumber()) { | 2747 if (obj->IsNumber()) { |
2748 num = obj; | 2748 num = obj; |
(...skipping 2825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5574 return Utils::ToLocal( | 5574 return Utils::ToLocal( |
5575 i::Handle<i::Symbol>(i::Symbol::cast(jsvalue->value()))); | 5575 i::Handle<i::Symbol>(i::Symbol::cast(jsvalue->value()))); |
5576 } | 5576 } |
5577 | 5577 |
5578 | 5578 |
5579 Local<v8::Value> v8::Date::New(Isolate* isolate, double time) { | 5579 Local<v8::Value> v8::Date::New(Isolate* isolate, double time) { |
5580 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5580 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
5581 LOG_API(i_isolate, "Date::New"); | 5581 LOG_API(i_isolate, "Date::New"); |
5582 if (std::isnan(time)) { | 5582 if (std::isnan(time)) { |
5583 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. | 5583 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. |
5584 time = base::OS::nan_value(); | 5584 time = std::numeric_limits<double>::quiet_NaN(); |
5585 } | 5585 } |
5586 ENTER_V8(i_isolate); | 5586 ENTER_V8(i_isolate); |
5587 EXCEPTION_PREAMBLE(i_isolate); | 5587 EXCEPTION_PREAMBLE(i_isolate); |
5588 i::Handle<i::Object> obj; | 5588 i::Handle<i::Object> obj; |
5589 has_pending_exception = !i::Execution::NewDate( | 5589 has_pending_exception = !i::Execution::NewDate( |
5590 i_isolate, time).ToHandle(&obj); | 5590 i_isolate, time).ToHandle(&obj); |
5591 EXCEPTION_BAILOUT_CHECK(i_isolate, Local<v8::Value>()); | 5591 EXCEPTION_BAILOUT_CHECK(i_isolate, Local<v8::Value>()); |
5592 return Utils::ToLocal(obj); | 5592 return Utils::ToLocal(obj); |
5593 } | 5593 } |
5594 | 5594 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6095 } | 6095 } |
6096 Local<Symbol> result = Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol)); | 6096 Local<Symbol> result = Utils::ToLocal(i::Handle<i::Symbol>::cast(symbol)); |
6097 return v8::Handle<Private>(reinterpret_cast<Private*>(*result)); | 6097 return v8::Handle<Private>(reinterpret_cast<Private*>(*result)); |
6098 } | 6098 } |
6099 | 6099 |
6100 | 6100 |
6101 Local<Number> v8::Number::New(Isolate* isolate, double value) { | 6101 Local<Number> v8::Number::New(Isolate* isolate, double value) { |
6102 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6102 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6103 if (std::isnan(value)) { | 6103 if (std::isnan(value)) { |
6104 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. | 6104 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. |
6105 value = base::OS::nan_value(); | 6105 value = std::numeric_limits<double>::quiet_NaN(); |
6106 } | 6106 } |
6107 ENTER_V8(internal_isolate); | 6107 ENTER_V8(internal_isolate); |
6108 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); | 6108 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); |
6109 return Utils::NumberToLocal(result); | 6109 return Utils::NumberToLocal(result); |
6110 } | 6110 } |
6111 | 6111 |
6112 | 6112 |
6113 Local<Integer> v8::Integer::New(Isolate* isolate, int32_t value) { | 6113 Local<Integer> v8::Integer::New(Isolate* isolate, int32_t value) { |
6114 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 6114 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
6115 if (i::Smi::IsValid(value)) { | 6115 if (i::Smi::IsValid(value)) { |
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7594 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7594 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7595 Address callback_address = | 7595 Address callback_address = |
7596 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7596 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7597 VMState<EXTERNAL> state(isolate); | 7597 VMState<EXTERNAL> state(isolate); |
7598 ExternalCallbackScope call_scope(isolate, callback_address); | 7598 ExternalCallbackScope call_scope(isolate, callback_address); |
7599 callback(info); | 7599 callback(info); |
7600 } | 7600 } |
7601 | 7601 |
7602 | 7602 |
7603 } } // namespace v8::internal | 7603 } } // namespace v8::internal |
OLD | NEW |