| 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 5826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5837 CHECK_EQ(v8_num(1.00), v8_num(1)); | 5837 CHECK_EQ(v8_num(1.00), v8_num(1)); |
| 5838 CHECK_NE(v8_num(1), v8_num(2)); | 5838 CHECK_NE(v8_num(1), v8_num(2)); |
| 5839 | 5839 |
| 5840 // Assume String is not internalized. | 5840 // Assume String is not internalized. |
| 5841 CHECK(v8_str("a")->StrictEquals(v8_str("a"))); | 5841 CHECK(v8_str("a")->StrictEquals(v8_str("a"))); |
| 5842 CHECK(!v8_str("a")->StrictEquals(v8_str("b"))); | 5842 CHECK(!v8_str("a")->StrictEquals(v8_str("b"))); |
| 5843 CHECK(!v8_str("5")->StrictEquals(v8_num(5))); | 5843 CHECK(!v8_str("5")->StrictEquals(v8_num(5))); |
| 5844 CHECK(v8_num(1)->StrictEquals(v8_num(1))); | 5844 CHECK(v8_num(1)->StrictEquals(v8_num(1))); |
| 5845 CHECK(!v8_num(1)->StrictEquals(v8_num(2))); | 5845 CHECK(!v8_num(1)->StrictEquals(v8_num(2))); |
| 5846 CHECK(v8_num(0.0)->StrictEquals(v8_num(-0.0))); | 5846 CHECK(v8_num(0.0)->StrictEquals(v8_num(-0.0))); |
| 5847 Local<Value> not_a_number = v8_num(v8::base::OS::nan_value()); | 5847 Local<Value> not_a_number = v8_num(std::numeric_limits<double>::quiet_NaN()); |
| 5848 CHECK(!not_a_number->StrictEquals(not_a_number)); | 5848 CHECK(!not_a_number->StrictEquals(not_a_number)); |
| 5849 CHECK(v8::False(isolate)->StrictEquals(v8::False(isolate))); | 5849 CHECK(v8::False(isolate)->StrictEquals(v8::False(isolate))); |
| 5850 CHECK(!v8::False(isolate)->StrictEquals(v8::Undefined(isolate))); | 5850 CHECK(!v8::False(isolate)->StrictEquals(v8::Undefined(isolate))); |
| 5851 | 5851 |
| 5852 v8::Handle<v8::Object> obj = v8::Object::New(isolate); | 5852 v8::Handle<v8::Object> obj = v8::Object::New(isolate); |
| 5853 v8::Persistent<v8::Object> alias(isolate, obj); | 5853 v8::Persistent<v8::Object> alias(isolate, obj); |
| 5854 CHECK(v8::Local<v8::Object>::New(isolate, alias)->StrictEquals(obj)); | 5854 CHECK(v8::Local<v8::Object>::New(isolate, alias)->StrictEquals(obj)); |
| 5855 alias.Reset(); | 5855 alias.Reset(); |
| 5856 | 5856 |
| 5857 CHECK(v8_str("a")->SameValue(v8_str("a"))); | 5857 CHECK(v8_str("a")->SameValue(v8_str("a"))); |
| (...skipping 11107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16965 CHECK_EQ(false, result->BooleanValue()); | 16965 CHECK_EQ(false, result->BooleanValue()); |
| 16966 | 16966 |
| 16967 // Check other boundary conditions, values and operations. | 16967 // Check other boundary conditions, values and operations. |
| 16968 result = CompileRun("for (var i = 0; i < 8; i++) {" | 16968 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 16969 " ext_array[7] = undefined;" | 16969 " ext_array[7] = undefined;" |
| 16970 "}" | 16970 "}" |
| 16971 "ext_array[7];"); | 16971 "ext_array[7];"); |
| 16972 CHECK_EQ(0, result->Int32Value()); | 16972 CHECK_EQ(0, result->Int32Value()); |
| 16973 if (array_type == v8::kExternalFloat64Array || | 16973 if (array_type == v8::kExternalFloat64Array || |
| 16974 array_type == v8::kExternalFloat32Array) { | 16974 array_type == v8::kExternalFloat32Array) { |
| 16975 CHECK_EQ(static_cast<int>(v8::base::OS::nan_value()), | 16975 CHECK(std::isnan( |
| 16976 static_cast<int>( | 16976 i::Object::GetElement(isolate, jsobj, 7).ToHandleChecked()->Number())); |
| 16977 i::Object::GetElement( | |
| 16978 isolate, jsobj, 7).ToHandleChecked()->Number())); | |
| 16979 } else { | 16977 } else { |
| 16980 CheckElementValue(isolate, 0, jsobj, 7); | 16978 CheckElementValue(isolate, 0, jsobj, 7); |
| 16981 } | 16979 } |
| 16982 | 16980 |
| 16983 result = CompileRun("for (var i = 0; i < 8; i++) {" | 16981 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 16984 " ext_array[6] = '2.3';" | 16982 " ext_array[6] = '2.3';" |
| 16985 "}" | 16983 "}" |
| 16986 "ext_array[6];"); | 16984 "ext_array[6];"); |
| 16987 CHECK_EQ(2, result->Int32Value()); | 16985 CHECK_EQ(2, result->Int32Value()); |
| 16988 CHECK_EQ(2, | 16986 CHECK_EQ(2, |
| (...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19082 static uint64_t DoubleToBits(double value) { | 19080 static uint64_t DoubleToBits(double value) { |
| 19083 uint64_t target; | 19081 uint64_t target; |
| 19084 i::MemCopy(&target, &value, sizeof(target)); | 19082 i::MemCopy(&target, &value, sizeof(target)); |
| 19085 return target; | 19083 return target; |
| 19086 } | 19084 } |
| 19087 | 19085 |
| 19088 | 19086 |
| 19089 static double DoubleToDateTime(double input) { | 19087 static double DoubleToDateTime(double input) { |
| 19090 double date_limit = 864e13; | 19088 double date_limit = 864e13; |
| 19091 if (std::isnan(input) || input < -date_limit || input > date_limit) { | 19089 if (std::isnan(input) || input < -date_limit || input > date_limit) { |
| 19092 return v8::base::OS::nan_value(); | 19090 return std::numeric_limits<double>::quiet_NaN(); |
| 19093 } | 19091 } |
| 19094 return (input < 0) ? -(std::floor(-input)) : std::floor(input); | 19092 return (input < 0) ? -(std::floor(-input)) : std::floor(input); |
| 19095 } | 19093 } |
| 19096 | 19094 |
| 19097 | 19095 |
| 19098 // We don't have a consistent way to write 64-bit constants syntactically, so we | 19096 // We don't have a consistent way to write 64-bit constants syntactically, so we |
| 19099 // split them into two 32-bit constants and combine them programmatically. | 19097 // split them into two 32-bit constants and combine them programmatically. |
| 19100 static double DoubleFromBits(uint32_t high_bits, uint32_t low_bits) { | 19098 static double DoubleFromBits(uint32_t high_bits, uint32_t low_bits) { |
| 19101 return DoubleFromBits((static_cast<uint64_t>(high_bits) << 32) | low_bits); | 19099 return DoubleFromBits((static_cast<uint64_t>(high_bits) << 32) | low_bits); |
| 19102 } | 19100 } |
| (...skipping 5470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24573 "bar2.js"); | 24571 "bar2.js"); |
| 24574 } | 24572 } |
| 24575 | 24573 |
| 24576 | 24574 |
| 24577 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { | 24575 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { |
| 24578 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", | 24576 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", |
| 24579 " sourceMappingURL=bar2.js\n", "foo();", NULL}; | 24577 " sourceMappingURL=bar2.js\n", "foo();", NULL}; |
| 24580 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, | 24578 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, |
| 24581 "bar2.js"); | 24579 "bar2.js"); |
| 24582 } | 24580 } |
| OLD | NEW |