OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3178 ENTER_V8; | 3178 ENTER_V8; |
3179 i::Handle<i::JSObject> obj = | 3179 i::Handle<i::JSObject> obj = |
3180 i::Factory::NewJSObject(i::Top::object_function()); | 3180 i::Factory::NewJSObject(i::Top::object_function()); |
3181 return Utils::ToLocal(obj); | 3181 return Utils::ToLocal(obj); |
3182 } | 3182 } |
3183 | 3183 |
3184 | 3184 |
3185 Local<v8::Value> v8::Date::New(double time) { | 3185 Local<v8::Value> v8::Date::New(double time) { |
3186 EnsureInitialized("v8::Date::New()"); | 3186 EnsureInitialized("v8::Date::New()"); |
3187 LOG_API("Date::New"); | 3187 LOG_API("Date::New"); |
| 3188 if (isnan(time)) { |
| 3189 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. |
| 3190 time = i::OS::nan_value(); |
| 3191 } |
3188 ENTER_V8; | 3192 ENTER_V8; |
3189 EXCEPTION_PREAMBLE(); | 3193 EXCEPTION_PREAMBLE(); |
3190 i::Handle<i::Object> obj = | 3194 i::Handle<i::Object> obj = |
3191 i::Execution::NewDate(time, &has_pending_exception); | 3195 i::Execution::NewDate(time, &has_pending_exception); |
3192 EXCEPTION_BAILOUT_CHECK(Local<v8::Value>()); | 3196 EXCEPTION_BAILOUT_CHECK(Local<v8::Value>()); |
3193 return Utils::ToLocal(obj); | 3197 return Utils::ToLocal(obj); |
3194 } | 3198 } |
3195 | 3199 |
3196 | 3200 |
3197 double v8::Date::NumberValue() const { | 3201 double v8::Date::NumberValue() const { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3250 ENTER_V8; | 3254 ENTER_V8; |
3251 if (length == -1) length = strlen(data); | 3255 if (length == -1) length = strlen(data); |
3252 i::Handle<i::String> result = | 3256 i::Handle<i::String> result = |
3253 i::Factory::LookupSymbol(i::Vector<const char>(data, length)); | 3257 i::Factory::LookupSymbol(i::Vector<const char>(data, length)); |
3254 return Utils::ToLocal(result); | 3258 return Utils::ToLocal(result); |
3255 } | 3259 } |
3256 | 3260 |
3257 | 3261 |
3258 Local<Number> v8::Number::New(double value) { | 3262 Local<Number> v8::Number::New(double value) { |
3259 EnsureInitialized("v8::Number::New()"); | 3263 EnsureInitialized("v8::Number::New()"); |
| 3264 if (isnan(value)) { |
| 3265 // Introduce only canonical NaN value into the VM, to avoid signaling NaNs. |
| 3266 value = i::OS::nan_value(); |
| 3267 } |
3260 ENTER_V8; | 3268 ENTER_V8; |
3261 i::Handle<i::Object> result = i::Factory::NewNumber(value); | 3269 i::Handle<i::Object> result = i::Factory::NewNumber(value); |
3262 return Utils::NumberToLocal(result); | 3270 return Utils::NumberToLocal(result); |
3263 } | 3271 } |
3264 | 3272 |
3265 | 3273 |
3266 Local<Integer> v8::Integer::New(int32_t value) { | 3274 Local<Integer> v8::Integer::New(int32_t value) { |
3267 EnsureInitialized("v8::Integer::New()"); | 3275 EnsureInitialized("v8::Integer::New()"); |
3268 if (i::Smi::IsValid(value)) { | 3276 if (i::Smi::IsValid(value)) { |
3269 return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value))); | 3277 return Utils::IntegerToLocal(i::Handle<i::Object>(i::Smi::FromInt(value))); |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3836 | 3844 |
3837 | 3845 |
3838 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 3846 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
3839 HandleScopeImplementer* thread_local = | 3847 HandleScopeImplementer* thread_local = |
3840 reinterpret_cast<HandleScopeImplementer*>(storage); | 3848 reinterpret_cast<HandleScopeImplementer*>(storage); |
3841 thread_local->IterateThis(v); | 3849 thread_local->IterateThis(v); |
3842 return storage + ArchiveSpacePerThread(); | 3850 return storage + ArchiveSpacePerThread(); |
3843 } | 3851 } |
3844 | 3852 |
3845 } } // namespace v8::internal | 3853 } } // namespace v8::internal |
OLD | NEW |