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_EQ(static_cast<int>(std::numeric_limits<double>::quiet_NaN()), |
16976 static_cast<int>( | 16976 static_cast<int>(i::Object::GetElement(isolate, jsobj, 7) |
16977 i::Object::GetElement( | 16977 .ToHandleChecked() |
16978 isolate, jsobj, 7).ToHandleChecked()->Number())); | 16978 ->Number())); |
16979 } else { | 16979 } else { |
16980 CheckElementValue(isolate, 0, jsobj, 7); | 16980 CheckElementValue(isolate, 0, jsobj, 7); |
16981 } | 16981 } |
16982 | 16982 |
16983 result = CompileRun("for (var i = 0; i < 8; i++) {" | 16983 result = CompileRun("for (var i = 0; i < 8; i++) {" |
16984 " ext_array[6] = '2.3';" | 16984 " ext_array[6] = '2.3';" |
16985 "}" | 16985 "}" |
16986 "ext_array[6];"); | 16986 "ext_array[6];"); |
16987 CHECK_EQ(2, result->Int32Value()); | 16987 CHECK_EQ(2, result->Int32Value()); |
16988 CHECK_EQ(2, | 16988 CHECK_EQ(2, |
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19082 static uint64_t DoubleToBits(double value) { | 19082 static uint64_t DoubleToBits(double value) { |
19083 uint64_t target; | 19083 uint64_t target; |
19084 i::MemCopy(&target, &value, sizeof(target)); | 19084 i::MemCopy(&target, &value, sizeof(target)); |
19085 return target; | 19085 return target; |
19086 } | 19086 } |
19087 | 19087 |
19088 | 19088 |
19089 static double DoubleToDateTime(double input) { | 19089 static double DoubleToDateTime(double input) { |
19090 double date_limit = 864e13; | 19090 double date_limit = 864e13; |
19091 if (std::isnan(input) || input < -date_limit || input > date_limit) { | 19091 if (std::isnan(input) || input < -date_limit || input > date_limit) { |
19092 return v8::base::OS::nan_value(); | 19092 return std::numeric_limits<double>::quiet_NaN(); |
19093 } | 19093 } |
19094 return (input < 0) ? -(std::floor(-input)) : std::floor(input); | 19094 return (input < 0) ? -(std::floor(-input)) : std::floor(input); |
19095 } | 19095 } |
19096 | 19096 |
19097 | 19097 |
19098 // We don't have a consistent way to write 64-bit constants syntactically, so we | 19098 // 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. | 19099 // split them into two 32-bit constants and combine them programmatically. |
19100 static double DoubleFromBits(uint32_t high_bits, uint32_t low_bits) { | 19100 static double DoubleFromBits(uint32_t high_bits, uint32_t low_bits) { |
19101 return DoubleFromBits((static_cast<uint64_t>(high_bits) << 32) | low_bits); | 19101 return DoubleFromBits((static_cast<uint64_t>(high_bits) << 32) | low_bits); |
19102 } | 19102 } |
(...skipping 5470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24573 "bar2.js"); | 24573 "bar2.js"); |
24574 } | 24574 } |
24575 | 24575 |
24576 | 24576 |
24577 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { | 24577 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { |
24578 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", | 24578 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", |
24579 " sourceMappingURL=bar2.js\n", "foo();", NULL}; | 24579 " sourceMappingURL=bar2.js\n", "foo();", NULL}; |
24580 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, | 24580 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, |
24581 "bar2.js"); | 24581 "bar2.js"); |
24582 } | 24582 } |
OLD | NEW |