Update V8 to r5017 as required by WebKit r62496
Change-Id: I1b4b7718d1d77ceef07f543e9150a2cb3a628f3a
diff --git a/test/cctest/SConscript b/test/cctest/SConscript
index 876c104..18388c0 100644
--- a/test/cctest/SConscript
+++ b/test/cctest/SConscript
@@ -69,8 +69,9 @@
'test-sockets.cc',
'test-spaces.cc',
'test-strings.cc',
- 'test-threads.cc',
'test-thread-termination.cc',
+ 'test-threads.cc',
+ 'test-type-info.cc',
'test-unbound-queue.cc',
'test-utils.cc',
'test-version.cc'
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index c426db4..745babc 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -58,7 +58,7 @@
using ::v8::AccessorInfo;
using ::v8::Extension;
-namespace i = ::v8::internal;
+namespace i = ::i;
static void ExpectString(const char* code, const char* expected) {
@@ -381,11 +381,11 @@
CHECK(source->IsExternal());
CHECK_EQ(resource,
static_cast<TestResource*>(source->GetExternalStringResource()));
- v8::internal::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(0, TestResource::dispose_count);
}
- v8::internal::CompilationCache::Clear();
- v8::internal::Heap::CollectAllGarbage(false);
+ i::CompilationCache::Clear();
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(1, TestResource::dispose_count);
}
@@ -402,11 +402,11 @@
Local<Value> value = script->Run();
CHECK(value->IsNumber());
CHECK_EQ(7, value->Int32Value());
- v8::internal::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(0, TestAsciiResource::dispose_count);
}
- v8::internal::CompilationCache::Clear();
- v8::internal::Heap::CollectAllGarbage(false);
+ i::CompilationCache::Clear();
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(1, TestAsciiResource::dispose_count);
}
@@ -427,11 +427,11 @@
Local<Value> value = script->Run();
CHECK(value->IsNumber());
CHECK_EQ(7, value->Int32Value());
- v8::internal::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(0, TestResource::dispose_count);
}
- v8::internal::CompilationCache::Clear();
- v8::internal::Heap::CollectAllGarbage(false);
+ i::CompilationCache::Clear();
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(1, TestResource::dispose_count);
}
@@ -453,11 +453,11 @@
Local<Value> value = script->Run();
CHECK(value->IsNumber());
CHECK_EQ(7, value->Int32Value());
- v8::internal::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(0, TestAsciiResource::dispose_count);
}
- v8::internal::CompilationCache::Clear();
- v8::internal::Heap::CollectAllGarbage(false);
+ i::CompilationCache::Clear();
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(1, TestAsciiResource::dispose_count);
}
@@ -645,11 +645,11 @@
Local<Value> value = script->Run();
CHECK(value->IsNumber());
CHECK_EQ(7, value->Int32Value());
- v8::internal::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(0, TestAsciiResource::dispose_count);
}
- v8::internal::CompilationCache::Clear();
- v8::internal::Heap::CollectAllGarbage(false);
+ i::CompilationCache::Clear();
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls);
CHECK_EQ(0, TestAsciiResource::dispose_count);
@@ -666,11 +666,11 @@
Local<Value> value = script->Run();
CHECK(value->IsNumber());
CHECK_EQ(7, value->Int32Value());
- v8::internal::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(0, TestAsciiResource::dispose_count);
}
- v8::internal::CompilationCache::Clear();
- v8::internal::Heap::CollectAllGarbage(false);
+ i::CompilationCache::Clear();
+ i::Heap::CollectAllGarbage(false);
CHECK_EQ(1, TestAsciiResourceWithDisposeControl::dispose_calls);
CHECK_EQ(1, TestAsciiResource::dispose_count);
}
@@ -708,7 +708,7 @@
CHECK(value->IsNumber());
CHECK_EQ(68, value->Int32Value());
}
- v8::internal::CompilationCache::Clear();
+ i::CompilationCache::Clear();
i::Heap::CollectAllGarbage(false);
i::Heap::CollectAllGarbage(false);
}
@@ -1881,7 +1881,7 @@
// that come after them so they cannot run in parallel.
TEST(OutOfMemory) {
// It's not possible to read a snapshot into a heap with different dimensions.
- if (v8::internal::Snapshot::IsEnabled()) return;
+ if (i::Snapshot::IsEnabled()) return;
// Set heap limits.
static const int K = 1024;
v8::ResourceConstraints constraints;
@@ -1922,7 +1922,7 @@
TEST(OutOfMemoryNested) {
// It's not possible to read a snapshot into a heap with different dimensions.
- if (v8::internal::Snapshot::IsEnabled()) return;
+ if (i::Snapshot::IsEnabled()) return;
// Set heap limits.
static const int K = 1024;
v8::ResourceConstraints constraints;
@@ -1951,7 +1951,7 @@
TEST(HugeConsStringOutOfMemory) {
// It's not possible to read a snapshot into a heap with different dimensions.
- if (v8::internal::Snapshot::IsEnabled()) return;
+ if (i::Snapshot::IsEnabled()) return;
v8::HandleScope scope;
LocalContext context;
// Set heap limits.
@@ -3335,6 +3335,42 @@
}
+
+THREADED_TEST(ExtensibleOnUndetectable) {
+ v8::HandleScope scope;
+ LocalContext env;
+
+ Local<v8::FunctionTemplate> desc =
+ v8::FunctionTemplate::New(0, v8::Handle<Value>());
+ desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable
+
+ Local<v8::Object> obj = desc->GetFunction()->NewInstance();
+ env->Global()->Set(v8_str("undetectable"), obj);
+
+ Local<String> source = v8_str("undetectable.x = 42;"
+ "undetectable.x");
+
+ Local<Script> script = Script::Compile(source);
+
+ CHECK_EQ(v8::Integer::New(42), script->Run());
+
+ ExpectBoolean("Object.isExtensible(undetectable)", true);
+
+ source = v8_str("Object.preventExtensions(undetectable);");
+ script = Script::Compile(source);
+ script->Run();
+ ExpectBoolean("Object.isExtensible(undetectable)", false);
+
+ source = v8_str("undetectable.y = 2000;");
+ script = Script::Compile(source);
+ v8::TryCatch try_catch;
+ Local<Value> result = script->Run();
+ CHECK(result.IsEmpty());
+ CHECK(try_catch.HasCaught());
+}
+
+
+
THREADED_TEST(UndetectableString) {
v8::HandleScope scope;
LocalContext env;
@@ -5035,6 +5071,31 @@
}
+static v8::Handle<v8::Array> NamedPropertyEnumerator(const AccessorInfo& info) {
+ v8::Handle<v8::Array> result = v8::Array::New(1);
+ result->Set(0, v8_str("x"));
+ return result;
+}
+
+
+THREADED_TEST(GetOwnPropertyNamesWithInterceptor) {
+ v8::HandleScope handle_scope;
+ v8::Handle<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New();
+
+ obj_template->Set(v8_str("x"), v8::Integer::New(42));
+ obj_template->SetNamedPropertyHandler(NULL, NULL, NULL, NULL,
+ NamedPropertyEnumerator);
+
+ LocalContext context;
+ v8::Handle<v8::Object> global = context->Global();
+ global->Set(v8_str("object"), obj_template->NewInstance());
+
+ v8::Handle<Value> value =
+ CompileRun("Object.getOwnPropertyNames(object).join(',')");
+ CHECK_EQ(v8_str("x"), value);
+}
+
+
static v8::Handle<Value> ConstTenGetter(Local<String> name,
const AccessorInfo& info) {
return v8_num(10);
@@ -6786,7 +6847,7 @@
int* call_count = reinterpret_cast<int*>(v8::External::Unwrap(info.Data()));
++(*call_count);
if ((*call_count) % 20 == 0) {
- v8::internal::Heap::CollectAllGarbage(true);
+ i::Heap::CollectAllGarbage(true);
}
return v8::Handle<Value>();
}
@@ -7595,8 +7656,8 @@
bool ApiTestFuzzer::fuzzing_ = false;
-v8::internal::Semaphore* ApiTestFuzzer::all_tests_done_=
- v8::internal::OS::CreateSemaphore(0);
+i::Semaphore* ApiTestFuzzer::all_tests_done_=
+ i::OS::CreateSemaphore(0);
int ApiTestFuzzer::active_tests_;
int ApiTestFuzzer::tests_being_run_;
int ApiTestFuzzer::current_;
@@ -7874,7 +7935,7 @@
static int GetGlobalObjectsCount() {
int count = 0;
- v8::internal::HeapIterator it;
+ i::HeapIterator it;
for (i::HeapObject* object = it.next(); object != NULL; object = it.next())
if (object->IsJSGlobalObject()) count++;
return count;
@@ -7887,11 +7948,11 @@
// the first garbage collection but some of the maps have already
// been marked at that point. Therefore some of the maps are not
// collected until the second garbage collection.
- v8::internal::Heap::CollectAllGarbage(false);
- v8::internal::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
int count = GetGlobalObjectsCount();
#ifdef DEBUG
- if (count > 0) v8::internal::Heap::TracePathToGlobal();
+ if (count > 0) i::Heap::TracePathToGlobal();
#endif
return count;
}
@@ -9996,7 +10057,7 @@
THREADED_TEST(ExternalByteArray) {
- ExternalArrayTestHelper<v8::internal::ExternalByteArray, int8_t>(
+ ExternalArrayTestHelper<i::ExternalByteArray, int8_t>(
v8::kExternalByteArray,
-128,
127);
@@ -10004,7 +10065,7 @@
THREADED_TEST(ExternalUnsignedByteArray) {
- ExternalArrayTestHelper<v8::internal::ExternalUnsignedByteArray, uint8_t>(
+ ExternalArrayTestHelper<i::ExternalUnsignedByteArray, uint8_t>(
v8::kExternalUnsignedByteArray,
0,
255);
@@ -10012,7 +10073,7 @@
THREADED_TEST(ExternalShortArray) {
- ExternalArrayTestHelper<v8::internal::ExternalShortArray, int16_t>(
+ ExternalArrayTestHelper<i::ExternalShortArray, int16_t>(
v8::kExternalShortArray,
-32768,
32767);
@@ -10020,7 +10081,7 @@
THREADED_TEST(ExternalUnsignedShortArray) {
- ExternalArrayTestHelper<v8::internal::ExternalUnsignedShortArray, uint16_t>(
+ ExternalArrayTestHelper<i::ExternalUnsignedShortArray, uint16_t>(
v8::kExternalUnsignedShortArray,
0,
65535);
@@ -10028,7 +10089,7 @@
THREADED_TEST(ExternalIntArray) {
- ExternalArrayTestHelper<v8::internal::ExternalIntArray, int32_t>(
+ ExternalArrayTestHelper<i::ExternalIntArray, int32_t>(
v8::kExternalIntArray,
INT_MIN, // -2147483648
INT_MAX); // 2147483647
@@ -10036,7 +10097,7 @@
THREADED_TEST(ExternalUnsignedIntArray) {
- ExternalArrayTestHelper<v8::internal::ExternalUnsignedIntArray, uint32_t>(
+ ExternalArrayTestHelper<i::ExternalUnsignedIntArray, uint32_t>(
v8::kExternalUnsignedIntArray,
0,
UINT_MAX); // 4294967295
@@ -10044,7 +10105,7 @@
THREADED_TEST(ExternalFloatArray) {
- ExternalArrayTestHelper<v8::internal::ExternalFloatArray, float>(
+ ExternalArrayTestHelper<i::ExternalFloatArray, float>(
v8::kExternalFloatArray,
-500,
500);
@@ -10522,7 +10583,7 @@
other_context->Enter();
CompileRun(source_simple);
other_context->Exit();
- v8::internal::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
if (GetGlobalObjectsCount() == 1) break;
}
CHECK_GE(2, gc_count);
@@ -10544,7 +10605,7 @@
other_context->Enter();
CompileRun(source_eval);
other_context->Exit();
- v8::internal::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
if (GetGlobalObjectsCount() == 1) break;
}
CHECK_GE(2, gc_count);
@@ -10571,7 +10632,7 @@
other_context->Enter();
CompileRun(source_exception);
other_context->Exit();
- v8::internal::Heap::CollectAllGarbage(false);
+ i::Heap::CollectAllGarbage(false);
if (GetGlobalObjectsCount() == 1) break;
}
CHECK_GE(2, gc_count);
@@ -10834,7 +10895,7 @@
" return 'Different results for ' + key1 + ': ' + r1 + ' vs. ' + r1_;"
" return 'PASSED';"
"})()";
- v8::internal::Heap::ClearJSFunctionResultCaches();
+ i::Heap::ClearJSFunctionResultCaches();
ExpectString(code, "PASSED");
}
@@ -10858,7 +10919,7 @@
" return 'FAILED: k0CacheSize is too small';"
" return 'PASSED';"
"})()";
- v8::internal::Heap::ClearJSFunctionResultCaches();
+ i::Heap::ClearJSFunctionResultCaches();
ExpectString(code, "PASSED");
}
@@ -10883,7 +10944,7 @@
" };"
" return 'PASSED';"
"})()";
- v8::internal::Heap::ClearJSFunctionResultCaches();
+ i::Heap::ClearJSFunctionResultCaches();
ExpectString(code, "PASSED");
}
@@ -10908,7 +10969,7 @@
" };"
" return 'PASSED';"
"})()";
- v8::internal::Heap::ClearJSFunctionResultCaches();
+ i::Heap::ClearJSFunctionResultCaches();
ExpectString(code, "PASSED");
}
@@ -10926,6 +10987,87 @@
" };"
" return 'PASSED';"
"})()";
- v8::internal::Heap::ClearJSFunctionResultCaches();
+ i::Heap::ClearJSFunctionResultCaches();
ExpectString(code, "PASSED");
}
+
+
+THREADED_TEST(TwoByteStringInAsciiCons) {
+ // See Chromium issue 47824.
+ v8::HandleScope scope;
+
+ LocalContext context;
+ const char* init_code =
+ "var str1 = 'abelspendabel';"
+ "var str2 = str1 + str1 + str1;"
+ "str2;";
+ Local<Value> result = CompileRun(init_code);
+
+ CHECK(result->IsString());
+ i::Handle<i::String> string = v8::Utils::OpenHandle(String::Cast(*result));
+ int length = string->length();
+ CHECK(string->IsAsciiRepresentation());
+
+ FlattenString(string);
+ i::Handle<i::String> flat_string = FlattenGetString(string);
+
+ CHECK(string->IsAsciiRepresentation());
+ CHECK(flat_string->IsAsciiRepresentation());
+
+ // Create external resource.
+ uint16_t* uc16_buffer = new uint16_t[length + 1];
+
+ i::String::WriteToFlat(*flat_string, uc16_buffer, 0, length);
+ uc16_buffer[length] = 0;
+
+ TestResource resource(uc16_buffer);
+
+ flat_string->MakeExternal(&resource);
+
+ CHECK(flat_string->IsTwoByteRepresentation());
+
+ // At this point, we should have a Cons string which is flat and ASCII,
+ // with a first half that is a two-byte string (although it only contains
+ // ASCII characters). This is a valid sequence of steps, and it can happen
+ // in real pages.
+
+ CHECK(string->IsAsciiRepresentation());
+ i::ConsString* cons = i::ConsString::cast(*string);
+ CHECK_EQ(0, cons->second()->length());
+ CHECK(cons->first()->IsTwoByteRepresentation());
+
+ // Check that some string operations work.
+
+ // Atom RegExp.
+ Local<Value> reresult = CompileRun("str2.match(/abel/g).length;");
+ CHECK_EQ(6, reresult->Int32Value());
+
+ // Nonatom RegExp.
+ reresult = CompileRun("str2.match(/abe./g).length;");
+ CHECK_EQ(6, reresult->Int32Value());
+
+ reresult = CompileRun("str2.search(/bel/g);");
+ CHECK_EQ(1, reresult->Int32Value());
+
+ reresult = CompileRun("str2.search(/be./g);");
+ CHECK_EQ(1, reresult->Int32Value());
+
+ ExpectTrue("/bel/g.test(str2);");
+
+ ExpectTrue("/be./g.test(str2);");
+
+ reresult = CompileRun("/bel/g.exec(str2);");
+ CHECK(!reresult->IsNull());
+
+ reresult = CompileRun("/be./g.exec(str2);");
+ CHECK(!reresult->IsNull());
+
+ ExpectString("str2.substring(2, 10);", "elspenda");
+
+ ExpectString("str2.substring(2, 20);", "elspendabelabelspe");
+
+ ExpectString("str2.charAt(2);", "e");
+
+ reresult = CompileRun("str2.charCodeAt(2);");
+ CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value());
+}
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index e689637..8ebf752 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -2075,6 +2075,39 @@
}
+// Test that it is possible to add and remove break points in a top level
+// function which has no references but has not been collected yet.
+TEST(ScriptBreakPointTopLevelCrash) {
+ v8::HandleScope scope;
+ DebugLocalContext env;
+ env.ExposeDebug();
+
+ v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
+ v8::Undefined());
+
+ v8::Local<v8::String> script_source = v8::String::New(
+ "function f() {\n"
+ " return 0;\n"
+ "}\n"
+ "f()");
+
+ int sbp1 = SetScriptBreakPointByNameFromJS("test.html", 3, -1);
+ {
+ v8::HandleScope scope;
+ break_point_hit_count = 0;
+ v8::Script::Compile(script_source, v8::String::New("test.html"))->Run();
+ CHECK_EQ(1, break_point_hit_count);
+ }
+
+ int sbp2 = SetScriptBreakPointByNameFromJS("test.html", 3, -1);
+ ClearBreakPointFromJS(sbp1);
+ ClearBreakPointFromJS(sbp2);
+
+ v8::Debug::SetDebugEventListener(NULL);
+ CheckDebuggerUnloaded();
+}
+
+
// Test that it is possible to remove the last break point for a function
// inside the break handling of that break point.
TEST(RemoveBreakPointInBreak) {
@@ -2129,7 +2162,7 @@
}
-// Test setting a breakpoint on the debugger statement.
+// Test setting a breakpoint on the debugger statement.
TEST(DebuggerStatementBreakpoint) {
break_point_hit_count = 0;
v8::HandleScope scope;
diff --git a/test/cctest/test-disasm-arm.cc b/test/cctest/test-disasm-arm.cc
index 5903fe6..f890fc1 100644
--- a/test/cctest/test-disasm-arm.cc
+++ b/test/cctest/test-disasm-arm.cc
@@ -401,3 +401,43 @@
VERIFY_RUN();
}
+
+
+TEST(Vfp) {
+ SETUP();
+
+ if (CpuFeatures::IsSupported(VFP3)) {
+ CpuFeatures::Scope scope(VFP3);
+ COMPARE(vmov(d0, d1),
+ "eeb00b41 vmov.f64 d0, d1");
+ COMPARE(vmov(d3, d3, eq),
+ "0eb03b43 vmov.f64eq d3, d3");
+
+ COMPARE(vadd(d0, d1, d2),
+ "ee310b02 vadd.f64 d0, d1, d2");
+ COMPARE(vadd(d3, d4, d5, mi),
+ "4e343b05 vadd.f64mi d3, d4, d5");
+
+ COMPARE(vsub(d0, d1, d2),
+ "ee310b42 vsub.f64 d0, d1, d2");
+ COMPARE(vsub(d3, d4, d5, ne),
+ "1e343b45 vsub.f64ne d3, d4, d5");
+
+ COMPARE(vmul(d2, d1, d0),
+ "ee212b00 vmul.f64 d2, d1, d0");
+ COMPARE(vmul(d6, d4, d5, cc),
+ "3e246b05 vmul.f64cc d6, d4, d5");
+
+ COMPARE(vdiv(d2, d2, d2),
+ "ee822b02 vdiv.f64 d2, d2, d2");
+ COMPARE(vdiv(d6, d7, d7, hi),
+ "8e876b07 vdiv.f64hi d6, d7, d7");
+
+ COMPARE(vsqrt(d0, d0),
+ "eeb10bc0 vsqrt.f64 d0, d0");
+ COMPARE(vsqrt(d2, d3, ne),
+ "1eb12bc3 vsqrt.f64ne d2, d3");
+ }
+
+ VERIFY_RUN();
+}
diff --git a/test/cctest/test-macro-assembler-x64.cc b/test/cctest/test-macro-assembler-x64.cc
index dd97498..3d2b91b 100755
--- a/test/cctest/test-macro-assembler-x64.cc
+++ b/test/cctest/test-macro-assembler-x64.cc
@@ -57,10 +57,9 @@
using v8::internal::r8;
using v8::internal::r9;
using v8::internal::r11;
-using v8::internal::r12; // Remember: r12..r15 are callee save!
+using v8::internal::r12;
using v8::internal::r13;
using v8::internal::r14;
-using v8::internal::r15;
using v8::internal::times_pointer_size;
using v8::internal::FUNCTION_CAST;
using v8::internal::CodeDesc;
@@ -92,6 +91,24 @@
#define __ masm->
+
+static void EntryCode(MacroAssembler* masm) {
+ // Smi constant register is callee save.
+ __ push(v8::internal::kSmiConstantRegister);
+ __ InitializeSmiConstantRegister();
+}
+
+
+static void ExitCode(MacroAssembler* masm) {
+ // Return -1 if kSmiConstantRegister was clobbered during the test.
+ __ Move(rdx, Smi::FromInt(1));
+ __ cmpq(rdx, v8::internal::kSmiConstantRegister);
+ __ movq(rdx, Immediate(-1));
+ __ cmovq(not_equal, rax, rdx);
+ __ pop(v8::internal::kSmiConstantRegister);
+}
+
+
TEST(Smi) {
// Check that C++ Smi operations work as expected.
int64_t test_numbers[] = {
@@ -139,6 +156,7 @@
MacroAssembler assembler(buffer, static_cast<int>(actual_size));
MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestMoveSmi(masm, &exit, 1, Smi::FromInt(0));
@@ -156,6 +174,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -225,6 +244,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiCompare(masm, &exit, 0x10, 0, 0);
@@ -249,6 +269,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -272,6 +293,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
__ movq(rax, Immediate(1)); // Test number.
@@ -349,6 +371,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -397,6 +420,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2;
@@ -416,6 +440,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -438,6 +463,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
Condition cond;
@@ -613,6 +639,7 @@
__ xor_(rax, rax);
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -683,6 +710,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiNeg(masm, &exit, 0x10, 0);
@@ -696,6 +724,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -768,6 +797,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
// No-overflow tests.
@@ -782,6 +812,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -955,6 +986,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
SmiSubTest(masm, &exit, 0x10, 1, 2);
@@ -977,6 +1009,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1042,6 +1075,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiMul(masm, &exit, 0x10, 0, 0);
@@ -1061,6 +1095,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1081,51 +1116,51 @@
#endif
bool fraction = !division_by_zero && !overflow && (x % y != 0);
__ Move(r11, Smi::FromInt(x));
- __ Move(r12, Smi::FromInt(y));
+ __ Move(r14, Smi::FromInt(y));
if (!fraction && !overflow && !negative_zero && !division_by_zero) {
// Division succeeds
__ movq(rcx, r11);
- __ movq(r15, Immediate(id));
+ __ movq(r12, Immediate(id));
int result = x / y;
__ Move(r8, Smi::FromInt(result));
- __ SmiDiv(r9, rcx, r12, exit);
- // Might have destroyed rcx and r12.
- __ incq(r15);
+ __ SmiDiv(r9, rcx, r14, exit);
+ // Might have destroyed rcx and r14.
+ __ incq(r12);
__ SmiCompare(r9, r8);
__ j(not_equal, exit);
- __ incq(r15);
+ __ incq(r12);
__ movq(rcx, r11);
- __ Move(r12, Smi::FromInt(y));
+ __ Move(r14, Smi::FromInt(y));
__ SmiCompare(rcx, r11);
__ j(not_equal, exit);
- __ incq(r15);
- __ SmiDiv(rcx, rcx, r12, exit);
+ __ incq(r12);
+ __ SmiDiv(rcx, rcx, r14, exit);
- __ incq(r15);
+ __ incq(r12);
__ SmiCompare(rcx, r8);
__ j(not_equal, exit);
} else {
// Division fails.
- __ movq(r15, Immediate(id + 8));
+ __ movq(r12, Immediate(id + 8));
Label fail_ok, fail_ok2;
__ movq(rcx, r11);
- __ SmiDiv(r9, rcx, r12, &fail_ok);
+ __ SmiDiv(r9, rcx, r14, &fail_ok);
__ jmp(exit);
__ bind(&fail_ok);
- __ incq(r15);
+ __ incq(r12);
__ SmiCompare(rcx, r11);
__ j(not_equal, exit);
- __ incq(r15);
- __ SmiDiv(rcx, rcx, r12, &fail_ok2);
+ __ incq(r12);
+ __ SmiDiv(rcx, rcx, r14, &fail_ok2);
__ jmp(exit);
__ bind(&fail_ok2);
- __ incq(r15);
+ __ incq(r12);
__ SmiCompare(rcx, r11);
__ j(not_equal, exit);
}
@@ -1145,10 +1180,11 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
+ __ push(r14);
__ push(r12);
- __ push(r15);
TestSmiDiv(masm, &exit, 0x10, 1, 1);
TestSmiDiv(masm, &exit, 0x20, 1, 0);
TestSmiDiv(masm, &exit, 0x30, -1, 0);
@@ -1170,11 +1206,12 @@
TestSmiDiv(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue);
TestSmiDiv(masm, &exit, 0x140, Smi::kMinValue, -1);
- __ xor_(r15, r15); // Success.
+ __ xor_(r12, r12); // Success.
__ bind(&exit);
- __ movq(rax, r15);
- __ pop(r15);
+ __ movq(rax, r12);
__ pop(r12);
+ __ pop(r14);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1192,47 +1229,47 @@
bool negative_zero = (!fraction && x < 0);
__ Move(rcx, Smi::FromInt(x));
__ movq(r11, rcx);
- __ Move(r12, Smi::FromInt(y));
+ __ Move(r14, Smi::FromInt(y));
if (!division_overflow && !negative_zero && !division_by_zero) {
// Modulo succeeds
- __ movq(r15, Immediate(id));
+ __ movq(r12, Immediate(id));
int result = x % y;
__ Move(r8, Smi::FromInt(result));
- __ SmiMod(r9, rcx, r12, exit);
+ __ SmiMod(r9, rcx, r14, exit);
- __ incq(r15);
+ __ incq(r12);
__ SmiCompare(r9, r8);
__ j(not_equal, exit);
- __ incq(r15);
+ __ incq(r12);
__ SmiCompare(rcx, r11);
__ j(not_equal, exit);
- __ incq(r15);
- __ SmiMod(rcx, rcx, r12, exit);
+ __ incq(r12);
+ __ SmiMod(rcx, rcx, r14, exit);
- __ incq(r15);
+ __ incq(r12);
__ SmiCompare(rcx, r8);
__ j(not_equal, exit);
} else {
// Modulo fails.
- __ movq(r15, Immediate(id + 8));
+ __ movq(r12, Immediate(id + 8));
Label fail_ok, fail_ok2;
- __ SmiMod(r9, rcx, r12, &fail_ok);
+ __ SmiMod(r9, rcx, r14, &fail_ok);
__ jmp(exit);
__ bind(&fail_ok);
- __ incq(r15);
+ __ incq(r12);
__ SmiCompare(rcx, r11);
__ j(not_equal, exit);
- __ incq(r15);
- __ SmiMod(rcx, rcx, r12, &fail_ok2);
+ __ incq(r12);
+ __ SmiMod(rcx, rcx, r14, &fail_ok2);
__ jmp(exit);
__ bind(&fail_ok2);
- __ incq(r15);
+ __ incq(r12);
__ SmiCompare(rcx, r11);
__ j(not_equal, exit);
}
@@ -1252,10 +1289,11 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
+ __ push(r14);
__ push(r12);
- __ push(r15);
TestSmiMod(masm, &exit, 0x10, 1, 1);
TestSmiMod(masm, &exit, 0x20, 1, 0);
TestSmiMod(masm, &exit, 0x30, -1, 0);
@@ -1277,11 +1315,12 @@
TestSmiMod(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue);
TestSmiMod(masm, &exit, 0x140, Smi::kMinValue, -1);
- __ xor_(r15, r15); // Success.
+ __ xor_(r12, r12); // Success.
__ bind(&exit);
- __ movq(rax, r15);
- __ pop(r15);
+ __ movq(rax, r12);
__ pop(r12);
+ __ pop(r14);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1336,7 +1375,7 @@
// Allocate an executable page of memory.
size_t actual_size;
byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
+ static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
&actual_size,
true));
CHECK(buffer);
@@ -1345,6 +1384,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiIndex(masm, &exit, 0x10, 0);
@@ -1355,6 +1395,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1411,6 +1452,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false); // Avoid inline checks.
+ EntryCode(masm);
Label exit;
TestSelectNonSmi(masm, &exit, 0x10, 0, 0);
@@ -1425,6 +1467,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1487,6 +1530,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiAnd(masm, &exit, 0x10, 0, 0);
@@ -1503,6 +1547,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1565,6 +1610,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiOr(masm, &exit, 0x10, 0, 0);
@@ -1583,6 +1629,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1645,6 +1692,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiXor(masm, &exit, 0x10, 0, 0);
@@ -1663,6 +1711,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1709,6 +1758,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiNot(masm, &exit, 0x10, 0);
@@ -1722,6 +1772,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1793,7 +1844,7 @@
// Allocate an executable page of memory.
size_t actual_size;
byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
+ static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
&actual_size,
true));
CHECK(buffer);
@@ -1802,6 +1853,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiShiftLeft(masm, &exit, 0x10, 0);
@@ -1814,6 +1866,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1896,7 +1949,7 @@
// Allocate an executable page of memory.
size_t actual_size;
byte* buffer =
- static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
+ static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
&actual_size,
true));
CHECK(buffer);
@@ -1905,6 +1958,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiShiftLogicalRight(masm, &exit, 0x10, 0);
@@ -1917,6 +1971,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -1971,6 +2026,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0);
@@ -1983,6 +2039,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -2032,6 +2089,7 @@
MacroAssembler* masm = &assembler;
masm->set_allow_stub_calls(false);
+ EntryCode(masm);
Label exit;
TestPositiveSmiPowerUp(masm, &exit, 0x20, 0);
@@ -2046,6 +2104,7 @@
__ xor_(rax, rax); // Success.
__ bind(&exit);
+ ExitCode(masm);
__ ret(0);
CodeDesc desc;
@@ -2074,8 +2133,9 @@
masm->set_allow_stub_calls(false);
Label exit;
- __ push(r12);
+ EntryCode(masm);
__ push(r13);
+ __ push(r14);
__ push(rbx);
__ push(rbp);
__ push(Immediate(0x100)); // <-- rbp
@@ -2093,7 +2153,7 @@
// r12 = rsp[3]
// rbx = rsp[5]
// r13 = rsp[7]
- __ lea(r12, Operand(rsp, 3 * kPointerSize));
+ __ lea(r14, Operand(rsp, 3 * kPointerSize));
__ lea(r13, Operand(rbp, -3 * kPointerSize));
__ lea(rbx, Operand(rbp, -5 * kPointerSize));
__ movl(rcx, Immediate(2));
@@ -2396,8 +2456,9 @@
__ lea(rsp, Operand(rbp, kPointerSize));
__ pop(rbp);
__ pop(rbx);
+ __ pop(r14);
__ pop(r13);
- __ pop(r12);
+ ExitCode(masm);
__ ret(0);
diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc
index 308f764..ea477de 100644
--- a/test/cctest/test-profile-generator.cc
+++ b/test/cctest/test-profile-generator.cc
@@ -653,7 +653,7 @@
time += SampleRateCalculator::kWallTimeQueryIntervalMs * 0.75;
calc2.UpdateMeasurements(time);
// (1.0 + 2.0 + 2.0) / 3
- CHECK_EQ(kSamplingIntervalMs * 1.66666, calc2.ticks_per_ms());
+ CHECK_EQ(kSamplingIntervalMs * 5.0, floor(calc2.ticks_per_ms() * 3.0 + 0.5));
SampleRateCalculator calc3;
time = 0.0;
@@ -667,7 +667,7 @@
time += SampleRateCalculator::kWallTimeQueryIntervalMs * 1.5;
calc3.UpdateMeasurements(time);
// (1.0 + 0.5 + 0.5) / 3
- CHECK_EQ(kSamplingIntervalMs * 0.66666, calc3.ticks_per_ms());
+ CHECK_EQ(kSamplingIntervalMs * 2.0, floor(calc3.ticks_per_ms() * 3.0 + 0.5));
}
diff --git a/test/cctest/test-type-info.cc b/test/cctest/test-type-info.cc
new file mode 100644
index 0000000..59dd83d
--- /dev/null
+++ b/test/cctest/test-type-info.cc
@@ -0,0 +1,56 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+#include "cctest.h"
+#include "type-info.h"
+
+namespace v8 {
+namespace internal {
+
+TEST(ThreeBitRepresentation) {
+ // Numeric types and unknown should fit into the short
+ // representation.
+ CHECK(TypeInfo::ExpandedRepresentation(
+ TypeInfo::Unknown().ThreeBitRepresentation()).IsUnknown());
+ CHECK(TypeInfo::ExpandedRepresentation(
+ TypeInfo::Number().ThreeBitRepresentation()).IsNumber());
+ CHECK(TypeInfo::ExpandedRepresentation(
+ TypeInfo::Integer32().ThreeBitRepresentation()).IsInteger32());
+ CHECK(TypeInfo::ExpandedRepresentation(
+ TypeInfo::Smi().ThreeBitRepresentation()).IsSmi());
+ CHECK(TypeInfo::ExpandedRepresentation(
+ TypeInfo::Double().ThreeBitRepresentation()).IsDouble());
+
+ // Other types should map to unknown.
+ CHECK(TypeInfo::ExpandedRepresentation(
+ TypeInfo::Primitive().ThreeBitRepresentation()).IsUnknown());
+ CHECK(TypeInfo::ExpandedRepresentation(
+ TypeInfo::String().ThreeBitRepresentation()).IsUnknown());
+}
+
+} } // namespace v8::internal
diff --git a/test/es5conform/README b/test/es5conform/README
index 9cfc92b..675249e 100644
--- a/test/es5conform/README
+++ b/test/es5conform/README
@@ -4,7 +4,7 @@
https://es5conform.svn.codeplex.com/svn
-in revision 62998 as 'data' in this directory. Using later version
+in revision 71525 as 'data' in this directory. Using later version
may be possible but the tests are only known to pass (and indeed run)
with that revision.
diff --git a/test/es5conform/es5conform.status b/test/es5conform/es5conform.status
index 9d9dc3c..e461349 100644
--- a/test/es5conform/es5conform.status
+++ b/test/es5conform/es5conform.status
@@ -29,91 +29,96 @@
def UNIMPLEMENTED = PASS || FAIL
def FAIL_OK = FAIL, OKAY
-chapter07: UNIMPLEMENTED
-chapter08: UNIMPLEMENTED
-chapter10: UNIMPLEMENTED
-chapter11: UNIMPLEMENTED
-chapter12: UNIMPLEMENTED
-chapter13: UNIMPLEMENTED
-chapter14: UNIMPLEMENTED
-chapter15/15.1: UNIMPLEMENTED
-chapter15/15.2/15.2.3/15.2.3.1: UNIMPLEMENTED
-chapter15/15.2/15.2.3/15.2.3.8: UNIMPLEMENTED
-chapter15/15.2/15.2.3/15.2.3.9: UNIMPLEMENTED
-chapter15/15.2/15.2.3/15.2.3.10: UNIMPLEMENTED
-chapter15/15.2/15.2.3/15.2.3.11: UNIMPLEMENTED
-chapter15/15.2/15.2.3/15.2.3.12: UNIMPLEMENTED
-chapter15/15.2/15.2.3/15.2.3.13: UNIMPLEMENTED
+# Non UTF8 characters in test files.
+chapter10/10.4/10.4.2/10.4.2-3-c-2-s: FAIL_OK
+chapter10/10.4/10.4.2/10.4.2-3-c-1-s: FAIL_OK
+chapter10/10.4/10.4.2/10.4.2-2-c-1: FAIL_OK
+
+# We do not implement the error chekcs specified in the production rules
+# of 11.1.5 (Object initializer).
+# We are compatible with Safari and Firefox.
+chapter11/11.1/11.1.5: UNIMPLEMENTED
+
+# Delete returns true in eval even when it should return false.
+# Please see http://code.google.com/p/v8/issues/detail?id=759
+chapter11/11.4/11.4.1//11.4.1-4.a-5: FAIL
+chapter11/11.4/11.4.1//11.4.1-4.a-7: FAIL
+
+# We do not have a global object called 'global' as required by tests.
+chapter15/15.1: FAIL_OK
# NOT IMPLEMENTED: seal
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-20: FAIL_OK
+chapter15/15.2/15.2.3/15.2.3.8: UNIMPLEMENTED
+# NOT IMPLEMENTED: freeze
+chapter15/15.2/15.2.3/15.2.3.9: UNIMPLEMENTED
+# NOT IMPLEMENTED: isSealed
+chapter15/15.2/15.2.3/15.2.3.11: UNIMPLEMENTED
+# NOT IMPLEMENTED: isFrozen
+chapter15/15.2/15.2.3/15.2.3.12: UNIMPLEMENTED
+
+# NOT IMPLEMENTED: seal
+chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-20: UNIMPLEMENTED
# NOT IMPLEMENTED: freeze
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-21: FAIL_OK
-
-# NOT IMPLEMENTED: preventExtensions
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-22: FAIL_OK
+chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-21: UNIMPLEMENTED
# NOT IMPLEMENTED: isSealed
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-23: FAIL_OK
+chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-23: UNIMPLEMENTED
# NOT IMPLEMENTED: isFrozen
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-24: FAIL_OK
-
-# NOT IMPLEMENTED: isExtensible
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-25: FAIL_OK
+chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-24: UNIMPLEMENTED
# NOT IMPLEMENTED: bind
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-38: FAIL_OK
+chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-38: UNIMPLEMENTED
-# NaN is writable
+# NaN is writable. We are compatible with JSC.
chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-178: FAIL_OK
-# Infinity is writable
+# Infinity is writable. We are compatible with JSC.
chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-179: FAIL_OK
-# undefined is writable
+# undefined is writable. We are compatible with JSC.
chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-180: FAIL_OK
-# Our Function object has a "arguments" property which is used as a non
-# property in in the test
+# Our Function object has an "arguments" property which is used as a
+# non-property in the test.
chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-183: FAIL_OK
-# Our Function object has a "caller" property which is used as a non
-# property in in the test
+# Our Function object has a "caller" property which is used as a
+# non-property in in the test.
chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-184: FAIL_OK
-# Our function object has a name property which is used as a non
-# property in the test
+# Our function object has a name property which is used as a
+# non-property in the test.
chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-188: FAIL_OK
# NOT IMPLEMENTED: RegExp.prototype.source
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-212: FAIL_OK
+chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-212: UNIMPLEMENTED
# NOT IMPLEMENTED: RegExp.prototype.global
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-213: FAIL_OK
+chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-213: UNIMPLEMENTED
# NOT IMPLEMENTED: RegExp.prototype.ignoreCase
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-214: FAIL_OK
+chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-214: UNIMPLEMENTED
# NOT IMPLEMENTED: RegExp.prototype.multiline
-chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-215: FAIL_OK
+chapter15/15.2/15.2.3/15.2.3.3/15.2.3.3-4-215: UNIMPLEMENTED
# All of the tests below marked SUBSETFAIL (in 15.2.3.4) fail because
# the tests assumes that objects can not have more properties
# than those described in the spec - but according to spec they can
# have additional properties.
# All compareArray calls in these tests could be exchanged with a
-# isSubsetOfArray call (I will upload a path to the es5conform site)
+# isSubsetOfArray call (I will upload a path to the es5conform site).
# SUBSETFAIL
chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-1: FAIL_OK
-# SUBSETFAIL + we do not implement all methods on Object
+# SUBSETFAIL + we do not implement all methods on Object.
chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-2: FAIL_OK
# SUBSETFAIL
chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-3: FAIL_OK
-# SUBSETFAIL + we do not implement Function.prototype.bind
+# SUBSETFAIL + we do not implement Function.prototype.bind.
chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-4: FAIL_OK
# SUBSETFAIL
@@ -134,29 +139,29 @@
# SUBSETFAIL
chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-11: FAIL_OK
-# We do not implement all methods on RegExp
-chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-13: FAIL_OK
+# We do not implement all methods on RegExp.
+chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-13: FAIL
# SUBSETFAIL
chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-14: FAIL_OK
-# EvalError.prototype does not have message property
-chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-15: FAIL_OK
+# EvalError.prototype does not have message property.
+chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-15: FAIL
-# Rangeerror.prototype does not have message property
-chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-16: FAIL_OK
+# Rangeerror.prototype does not have message property.
+chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-16: FAIL
-# ReferenceError.prototype does not have message property
-chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-17: FAIL_OK
+# ReferenceError.prototype does not have message property.
+chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-17: FAIL
-# SyntaxError.prototype does not have message property
-chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-18: FAIL_OK
+# SyntaxError.prototype does not have message property.
+chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-18: FAIL
-# TypeError.prototype does not have message property
-chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-19: FAIL_OK
+# TypeError.prototype does not have message property.
+chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-19: FAIL
-# URIError.prototype does not have message property
-chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-20: FAIL_OK
+# URIError.prototype does not have message property.
+chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-20: FAIL
# SUBSETFAIL
chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-22: FAIL_OK
@@ -200,68 +205,65 @@
# SUBSETFAIL
chapter15/15.2/15.2.3/15.2.3.4/15.2.3.4-4-35: FAIL_OK
+# NOT IMPLEMENTED: bind on Function.prototype.
+chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-0-1: UNIMPLEMENTED
-# We fail this because Object.keys returns numbers for element indices
-# rather than strings.
-#chapter15/15.2/15.2.3/15.2.3.14/15.2.3.14-3-3: FAIL_OK
+# Bad test - the spec does not say anything about throwing errors
+# on calling Array.prototype.indexOf with undefined as argument.
+chapter15/15.4/15.4.4/15.4.4.14/15.4.4.14-1-1: FAIL_OK
-chapter15/15.3: UNIMPLEMENTED
+# Bad test - the spec does not say anything about throwing errors
+# on calling Array.prototype.indexOf with null as argument.
+chapter15/15.4/15.4.4/15.4.4.14/15.4.4.14-1-2: FAIL_OK
-chapter15/15.4/15.4.4/15.4.4.14: UNIMPLEMENTED
-chapter15/15.4/15.4.4/15.4.4.15: UNIMPLEMENTED
-chapter15/15.4/15.4.4/15.4.4.20: UNIMPLEMENTED
-chapter15/15.4/15.4.4/15.4.4.21: UNIMPLEMENTED
-chapter15/15.4/15.4.4/15.4.4.22: UNIMPLEMENTED
-
-# Wrong test - because this is not given as argument to arr.every
-# this._15_4_4_16_5_1 evaluates to undefined
-chapter15/15.4/15.4.4/15.4.4.16/15.4.4.16-5-1: FAIL_OK
-
-# In test case the element is not appended - it is added in the middle of
-# the array
-chapter15/15.4/15.4.4/15.4.4.16/15.4.4.16-7-1: FAIL_OK
-
-# We fail because the test assumes that if the reference to array is deleted it
-# is not longer traversed
-chapter15/15.4/15.4.4/15.4.4.16/15.4.4.16-7-7: FAIL_OK
-
-# if (val>1) in test should be if (val>2)
-chapter15/15.4/15.4.4/15.4.4.16/15.4.4.16-8-10: FAIL_OK
-
-# Wrong assumption - according to spec some returns a Boolean, not a number
-chapter15/15.4/15.4.4/15.4.4.17/15.4.4.17-4-9: FAIL_OK
-
-# Same as 15.4.4.16-5-1
-chapter15/15.4/15.4.4/15.4.4.17/15.4.4.17-5-1: FAIL_OK
-
-# Same as 15.4.4.16-7-1
-chapter15/15.4/15.4.4/15.4.4.17/15.4.4.17-7-1: FAIL_OK
-
-# Same as 15.4.4.16-7-7
-chapter15/15.4/15.4.4/15.4.4.17/15.4.4.17-7-7: FAIL_OK
-
-# Same as 15.4.4.16-10-8
+# Bad test - the test at the end should be "i === true".
chapter15/15.4/15.4.4/15.4.4.17/15.4.4.17-8-10: FAIL_OK
-# Same as 15.4.4.16-5-1
-chapter15/15.4/15.4.4/15.4.4.18/15.4.4.18-5-1: FAIL_OK
+# Bad test - according to spec some returns a Boolean, not a number.
+chapter15/15.4/15.4.4/15.4.4.17/15.4.4.17-4-9: FAIL_OK
-# Same as 15.4.4.16-7-7
-chapter15/15.4/15.4.4/15.4.4.18/15.4.4.18-7-6: FAIL_OK
+# Bad test - uses unitialized variable a in precondition check.
+chapter15/15.4/15.4.4/15.4.4.19/15.4.4.19-9-3: FAIL_OK
-# Same as 15.4.4.16-5-1
-chapter15/15.4/15.4.4/15.4.4.19/15.4.4.19-5-1: FAIL_OK
+# We do not implement Array mapping functions correctly if array
+# entries are added for nonexistent entries smaller than length by
+# the callback function. We are compatible with JSC.
+# See http://code.google.com/p/v8/issues/detail?id=755
+chapter15/15.4/15.4.4/15.4.4.22/15.4.4.22-9-1: FAIL_OK
-# Same as 15.4.4.16-7-7
-chapter15/15.4/15.4.4/15.4.4.19/15.4.4.19-8-7: FAIL_OK
+# Bad tests, path in test file is wrong. This will crash the test
+# script so we mark it SKIP.
+chapter15/15.4/15.4.4/15.4.4.22/15.4.4.22-9-c-ii-4: SKIP
+chapter15/15.4/15.4.4/15.4.4.22/15.4.4.22-9-c-ii-4-s: SKIP
+# Bad test - deleting the property on o in callbackfn will
+# have no effect on the actual array on which reduceRight is called.
+chapter15/15.4/15.4.4/15.4.4.22/15.4.4.22-9-7: FAIL_OK
-chapter15/15.5: UNIMPLEMENTED
-chapter15/15.6: UNIMPLEMENTED
-chapter15/15.7: UNIMPLEMENTED
-chapter15/15.9: UNIMPLEMENTED
-chapter15/15.10: UNIMPLEMENTED
-chapter15/15.12: UNIMPLEMENTED
+# We do not implement trim correctly on null and undefined.
+chapter15/15.5/15.5.4/15.5.4.20/15.5.4.20-1-1: FAIL
+chapter15/15.5/15.5.4/15.5.4.20/15.5.4.20-1-2: FAIL
+
+# We do not correctly recognize \uFEFF as whitespace
+chapter15/15.5/15.5.4/15.5.4.20/15.5.4.20-4-10: FAIL
+chapter15/15.5/15.5.4/15.5.4.20/15.5.4.20-4-18: FAIL
+chapter15/15.5/15.5.4/15.5.4.20/15.5.4.20-4-34: FAIL
+
+# RegExp.prototype is not of type RegExp - we are bug compatible with JSC.
+chapter15/15.10/15.10.6/15.10.6: FAIL_OK
+
+# We do not have the properties of a RegExp instance on RegExp.prototype.
+# The spec says we should - but we are currently bug compatible with JSC.
+chapter15/15.10/15.10.7/15.10.7.1/15.10.7.1-1: FAIL_OK
+chapter15/15.10/15.10.7/15.10.7.1/15.10.7.1-2: FAIL_OK
+chapter15/15.10/15.10.7/15.10.7.2/15.10.7.2-1: FAIL_OK
+chapter15/15.10/15.10.7/15.10.7.2/15.10.7.2-2: FAIL_OK
+chapter15/15.10/15.10.7/15.10.7.3/15.10.7.3-1: FAIL_OK
+chapter15/15.10/15.10.7/15.10.7.3/15.10.7.3-2: FAIL_OK
+chapter15/15.10/15.10.7/15.10.7.4/15.10.7.4-1: FAIL_OK
+chapter15/15.10/15.10.7/15.10.7.4/15.10.7.4-2: FAIL_OK
+chapter15/15.10/15.10.7/15.10.7.5/15.10.7.5-1: FAIL_OK
+chapter15/15.10/15.10.7/15.10.7.5/15.10.7.5-2: FAIL_OK
[ $arch == mips ]
diff --git a/test/mjsunit/call-stub.js b/test/mjsunit/call-stub.js
new file mode 100644
index 0000000..a9132a6
--- /dev/null
+++ b/test/mjsunit/call-stub.js
@@ -0,0 +1,51 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+function Hash() {
+ for (var i = 0; i < 100; i++) {
+ this['a' + i] = i;
+ }
+
+ delete this.a50; // Ensure it's a normal object.
+}
+
+Hash.prototype.m = function() {
+ return 1;
+};
+
+var h = new Hash();
+
+for (var i = 1; i < 100; i++) {
+ if (i == 50) {
+ h.m = function() {
+ return 2;
+ };
+ } else if (i == 70) {
+ delete h.m;
+ }
+ assertEquals(i < 50 || i >= 70 ? 1 : 2, h.m());
+}
diff --git a/test/mjsunit/date.js b/test/mjsunit/date.js
index b264a19..57fc5a0 100644
--- a/test/mjsunit/date.js
+++ b/test/mjsunit/date.js
@@ -154,6 +154,15 @@
testToLocaleTimeString();
+// Test that -0 is treated correctly in MakeDay.
+var d = new Date();
+assertDoesNotThrow("d.setDate(-0)");
+assertDoesNotThrow("new Date(-0, -0, -0, -0, -0, -0. -0)");
+assertDoesNotThrow("new Date(0x40000000, 0x40000000, 0x40000000," +
+ "0x40000000, 0x40000000, 0x40000000, 0x40000000)")
+assertDoesNotThrow("new Date(-0x40000001, -0x40000001, -0x40000001," +
+ "-0x40000001, -0x40000001, -0x40000001, -0x40000001)")
+
// Modified test from WebKit
// LayoutTests/fast/js/script-tests/date-utc-timeclip.js:
diff --git a/test/mjsunit/debug-liveedit-3.js b/test/mjsunit/debug-liveedit-3.js
index b68e38d..b210657 100644
--- a/test/mjsunit/debug-liveedit-3.js
+++ b/test/mjsunit/debug-liveedit-3.js
@@ -57,7 +57,8 @@
print("new source: " + new_source);
var change_log = new Array();
-Debug.LiveEdit.SetScriptSource(script, new_source, change_log);
+var result = Debug.LiveEdit.SetScriptSource(script, new_source, false, change_log);
+print("Result: " + JSON.stringify(result) + "\n");
print("Change log: " + JSON.stringify(change_log) + "\n");
assertEquals(8, z6());
diff --git a/test/mjsunit/debug-liveedit-breakpoints.js b/test/mjsunit/debug-liveedit-breakpoints.js
index 5c61cf4..f01a8c4 100644
--- a/test/mjsunit/debug-liveedit-breakpoints.js
+++ b/test/mjsunit/debug-liveedit-breakpoints.js
@@ -72,7 +72,8 @@
print("new source: " + new_source);
var change_log = new Array();
-Debug.LiveEdit.SetScriptSource(script, new_source, change_log);
+var result = Debug.LiveEdit.SetScriptSource(script, new_source, false, change_log);
+print("Result: " + JSON.stringify(result) + "\n");
print("Change log: " + JSON.stringify(change_log) + "\n");
var breaks = Debug.scriptBreakPoints();
diff --git a/test/mjsunit/debug-liveedit-newsource.js b/test/mjsunit/debug-liveedit-newsource.js
index db256a4..7b8945a 100644
--- a/test/mjsunit/debug-liveedit-newsource.js
+++ b/test/mjsunit/debug-liveedit-newsource.js
@@ -57,7 +57,8 @@
print("new source: " + new_source);
var change_log = new Array();
-Debug.LiveEdit.SetScriptSource(script, new_source, change_log);
+var result = Debug.LiveEdit.SetScriptSource(script, new_source, false, change_log);
+print("Result: " + JSON.stringify(result) + "\n");
print("Change log: " + JSON.stringify(change_log) + "\n");
assertEquals("Capybara", ChooseAnimal());
diff --git a/test/mjsunit/debug-setbreakpoint.js b/test/mjsunit/debug-setbreakpoint.js
index 9661c95..8201d63 100644
--- a/test/mjsunit/debug-setbreakpoint.js
+++ b/test/mjsunit/debug-setbreakpoint.js
@@ -63,6 +63,7 @@
} else {
assertFalse(response.success, request + ' -> ' + json_response);
}
+ return response;
}
function listener(event, exec_state, event_data, data) {
@@ -75,7 +76,7 @@
var request = '{' + base_request + '}'
var response = safeEval(dcp.processDebugJSONRequest(request));
assertFalse(response.success);
-
+
var mirror;
testArguments(dcp, '{}', false);
@@ -118,6 +119,12 @@
testArguments(dcp, '{"type":"script","target":"sourceUrlScript","line":0}', true, true);
+ // Set a break point on a line with the comment, and check that actual position
+ // is the next line after the comment.
+ request = '{"type":"scriptId","target":' + g_script_id + ',"line":' + (g_line + 1) + '}';
+ response = testArguments(dcp, request, true, false);
+ assertEquals(g_line + 2, response.body.actual_locations[0].line);
+
// Indicate that all was processed.
listenerComplete = true;
}
@@ -185,8 +192,3 @@
sourceUrlFunc();
assertTrue(breakListenerCalled, "Break listener not called on breakpoint set by sourceURL");
-
-// Set a break point on a line with the comment, and check that actual position
-// is the next line after the comment.
-var number = Debug.setScriptBreakPointById(g_script_id, g_line + 1);
-assertEquals(g_line + 2, Debug.findBreakPoint(number).actual_location.line);
diff --git a/test/mjsunit/for-in.js b/test/mjsunit/for-in.js
index e3436ff..ab35e95 100644
--- a/test/mjsunit/for-in.js
+++ b/test/mjsunit/for-in.js
@@ -84,3 +84,38 @@
for (var p in { get a() {}, set a(x) {}, b : 1}) { result += p; }
assertEquals('ab', result, "abgetset");
+
+// Test that for-in in the global scope works with a keyed property as "each".
+// Test outside a loop and in a loop for multiple iterations.
+a = [1,2,3,4];
+x = {foo:5, bar:6, zip:7, glep:9, 10:11};
+delete x.bar;
+y = {}
+
+for (a[2] in x) {
+ y[a[2]] = x[a[2]];
+}
+
+assertEquals(5, y.foo, "y.foo");
+assertEquals("undefined", typeof y.bar, "y.bar");
+assertEquals(7, y.zip, "y.zip");
+assertEquals(9, y.glep, "y.glep");
+assertEquals(11, y[10], "y[10]");
+assertEquals("undefined", typeof y[2], "y[2]");
+assertEquals("undefined", typeof y[0], "y[0]");
+
+for (i=0 ; i < 3; ++i) {
+ y = {}
+
+ for (a[2] in x) {
+ y[a[2]] = x[a[2]];
+ }
+
+ assertEquals(5, y.foo, "y.foo");
+ assertEquals("undefined", typeof y.bar, "y.bar");
+ assertEquals(7, y.zip, "y.zip");
+ assertEquals(9, y.glep, "y.glep");
+ assertEquals(11, y[10], "y[10]");
+ assertEquals("undefined", typeof y[2], "y[2]");
+ assertEquals("undefined", typeof y[0], "y[0]");
+}
diff --git a/test/mjsunit/math-pow.js b/test/mjsunit/math-pow.js
new file mode 100644
index 0000000..e732955
--- /dev/null
+++ b/test/mjsunit/math-pow.js
@@ -0,0 +1,129 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Tests the special cases specified by ES 15.8.2.13
+
+// Simple sanity check
+assertEquals(4, Math.pow(2, 2));
+assertEquals(2147483648, Math.pow(2, 31));
+assertEquals(0.25, Math.pow(2, -2));
+assertEquals(0.0625, Math.pow(2, -4));
+assertEquals(1, Math.pow(1, 100));
+assertEquals(0, Math.pow(0, 1000));
+
+// Spec tests
+assertEquals(NaN, Math.pow(2, NaN));
+assertEquals(NaN, Math.pow(+0, NaN));
+assertEquals(NaN, Math.pow(-0, NaN));
+assertEquals(NaN, Math.pow(Infinity, NaN));
+assertEquals(NaN, Math.pow(-Infinity, NaN));
+
+assertEquals(1, Math.pow(NaN, +0));
+assertEquals(1, Math.pow(NaN, -0));
+
+assertEquals(NaN, Math.pow(NaN, NaN));
+assertEquals(NaN, Math.pow(NaN, 2.2));
+assertEquals(NaN, Math.pow(NaN, 1));
+assertEquals(NaN, Math.pow(NaN, -1));
+assertEquals(NaN, Math.pow(NaN, -2.2));
+assertEquals(NaN, Math.pow(NaN, Infinity));
+assertEquals(NaN, Math.pow(NaN, -Infinity));
+
+assertEquals(Infinity, Math.pow(1.1, Infinity));
+assertEquals(Infinity, Math.pow(-1.1, Infinity));
+assertEquals(Infinity, Math.pow(2, Infinity));
+assertEquals(Infinity, Math.pow(-2, Infinity));
+
+assertEquals(+0, Math.pow(1.1, -Infinity));
+assertEquals(+0, Math.pow(-1.1, -Infinity));
+assertEquals(+0, Math.pow(2, -Infinity));
+assertEquals(+0, Math.pow(-2, -Infinity));
+
+assertEquals(NaN, Math.pow(1, Infinity));
+assertEquals(NaN, Math.pow(1, -Infinity));
+assertEquals(NaN, Math.pow(-1, Infinity));
+assertEquals(NaN, Math.pow(-1, -Infinity));
+
+assertEquals(+0, Math.pow(0.1, Infinity));
+assertEquals(+0, Math.pow(-0.1, Infinity));
+assertEquals(+0, Math.pow(0.999, Infinity));
+assertEquals(+0, Math.pow(-0.999, Infinity));
+
+assertEquals(Infinity, Math.pow(0.1, -Infinity));
+assertEquals(Infinity, Math.pow(-0.1, -Infinity));
+assertEquals(Infinity, Math.pow(0.999, -Infinity));
+assertEquals(Infinity, Math.pow(-0.999, -Infinity));
+
+assertEquals(Infinity, Math.pow(Infinity, 0.1));
+assertEquals(Infinity, Math.pow(Infinity, 2));
+
+assertEquals(+0, Math.pow(Infinity, -0.1));
+assertEquals(+0, Math.pow(Infinity, -2));
+
+assertEquals(-Infinity, Math.pow(-Infinity, 3));
+assertEquals(-Infinity, Math.pow(-Infinity, 13));
+
+assertEquals(Infinity, Math.pow(-Infinity, 3.1));
+assertEquals(Infinity, Math.pow(-Infinity, 2));
+
+assertEquals(-0, Math.pow(-Infinity, -3));
+assertEquals(-0, Math.pow(-Infinity, -13));
+
+assertEquals(+0, Math.pow(-Infinity, -3.1));
+assertEquals(+0, Math.pow(-Infinity, -2));
+
+assertEquals(+0, Math.pow(+0, 1.1));
+assertEquals(+0, Math.pow(+0, 2));
+
+assertEquals(Infinity, Math.pow(+0, -1.1));
+assertEquals(Infinity, Math.pow(+0, -2));
+
+assertEquals(-0, Math.pow(-0, 3));
+assertEquals(-0, Math.pow(-0, 13));
+
+assertEquals(+0, Math.pow(-0, 3.1));
+assertEquals(+0, Math.pow(-0, 2));
+
+assertEquals(-Infinity, Math.pow(-0, -3));
+assertEquals(-Infinity, Math.pow(-0, -13));
+
+assertEquals(Infinity, Math.pow(-0, -3.1));
+assertEquals(Infinity, Math.pow(-0, -2));
+
+assertEquals(NaN, Math.pow(-0.00001, 1.1));
+assertEquals(NaN, Math.pow(-0.00001, -1.1));
+assertEquals(NaN, Math.pow(-1.1, 1.1));
+assertEquals(NaN, Math.pow(-1.1, -1.1));
+assertEquals(NaN, Math.pow(-2, 1.1));
+assertEquals(NaN, Math.pow(-2, -1.1));
+assertEquals(NaN, Math.pow(-1000, 1.1));
+assertEquals(NaN, Math.pow(-1000, -1.1));
+
+// Tests from Sputnik S8.5_A13_T1.
+assertTrue((1*((Math.pow(2,53))-1)*(Math.pow(2,-1074))) === 4.4501477170144023e-308);
+assertTrue((1*(Math.pow(2,52))*(Math.pow(2,-1074))) === 2.2250738585072014e-308);
+assertTrue((-1*(Math.pow(2,52))*(Math.pow(2,-1074))) === -2.2250738585072014e-308);
diff --git a/test/mjsunit/math-sqrt.js b/test/mjsunit/math-sqrt.js
index ae29b74..fb00d5b 100644
--- a/test/mjsunit/math-sqrt.js
+++ b/test/mjsunit/math-sqrt.js
@@ -27,18 +27,23 @@
// Tests the special cases specified by ES 15.8.2.17
+function test(expected_sqrt, value) {
+ assertEquals(expected_sqrt, Math.sqrt(value));
+ if (isFinite(value)) {
+ assertEquals(expected_sqrt, Math.pow(value, 0.5));
+ }
+}
+
// Simple sanity check
-assertEquals(2, Math.sqrt(4));
-assertEquals(0.1, Math.sqrt(0.01));
+test(2, 4);
+test(0.1, 0.01);
// Spec tests
-assertEquals(NaN, Math.sqrt(NaN));
-assertEquals(NaN, Math.sqrt(-1));
-assertEquals(+0, Math.sqrt(+0));
-assertEquals(-0, Math.sqrt(-0));
-assertEquals(Infinity, Math.sqrt(Infinity));
+test(NaN, NaN);
+test(NaN, -1);
+test(+0, +0);
+test(-0, -0);
+test(Infinity, Infinity);
// -Infinity is smaller than 0 so it should return NaN
-assertEquals(NaN, Math.sqrt(-Infinity));
-
-
+test(NaN, -Infinity);
diff --git a/test/mjsunit/mod.js b/test/mjsunit/mod.js
new file mode 100644
index 0000000..8ad98fa
--- /dev/null
+++ b/test/mjsunit/mod.js
@@ -0,0 +1,53 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+function foo() {
+ for (var i = 1; i < 100; i++) {
+ var answer = 1;
+ for (var j = 1; j < 100; j++) {
+ if (answer == i) answer = 0;
+ // Positive case.
+ print(j + " % " + i + " = " + answer);
+ m = j % i;
+ assertEquals(answer, m, j + " % " + i);
+ m = j % (-i);
+ assertEquals(answer, m, j + " % -" + i);
+ // Negative case.
+ m = (-j) % i;
+ assertEquals(-answer, m, j + " % " + i);
+ // Check for negative zero.
+ if (answer == 0) assertEquals(-Infinity, 1/m);
+ m = (-j) % (-i);
+ assertEquals(-answer, m, j + " % -" + i);
+ // Check for negative zero.
+ if (answer == 0) assertEquals(-Infinity, 1/m);
+ answer++;
+ }
+ }
+}
+
+foo();
diff --git a/test/mjsunit/object-prevent-extensions.js b/test/mjsunit/object-prevent-extensions.js
new file mode 100644
index 0000000..ebc2cfa6
--- /dev/null
+++ b/test/mjsunit/object-prevent-extensions.js
@@ -0,0 +1,157 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Tests the Object.preventExtensions method - ES 15.2.3.10
+
+
+var obj1 = {};
+// Extensible defaults to true.
+assertTrue(Object.isExtensible(obj1));
+Object.preventExtensions(obj1);
+
+// Make sure the is_extensible flag is set.
+assertFalse(Object.isExtensible(obj1));
+// Try adding a new property.
+try {
+ obj1.x = 42;
+ assertUnreachable();
+} catch (e) {
+ assertTrue(/object is not extensible/.test(e));
+}
+assertEquals(undefined, obj1.x);
+
+// Try adding a new element.
+try {
+ obj1[1] = 42;
+ assertUnreachable();
+} catch (e) {
+ assertTrue(/object is not extensible/.test(e));
+}
+assertEquals(undefined, obj1[1]);
+
+
+// Try when the object has an existing property.
+var obj2 = {};
+assertTrue(Object.isExtensible(obj2));
+obj2.x = 42;
+assertEquals(42, obj2.x);
+assertTrue(Object.isExtensible(obj2));
+
+Object.preventExtensions(obj2);
+assertEquals(42, obj2.x);
+
+try {
+ obj2.y = 42;
+ assertUnreachable();
+} catch (e) {
+ assertTrue(/object is not extensible/.test(e));
+}
+
+// obj2.y should still be undefined.
+assertEquals(undefined, obj2.y);
+// Make sure we can still write values to obj.x.
+obj2.x = 43;
+assertEquals(43, obj2.x)
+
+try {
+ obj2.y = new function() { return 42; };
+ assertUnreachable();
+} catch (e) {
+ assertTrue(/object is not extensible/.test(e));
+}
+// obj2.y should still be undefined.
+assertEquals(undefined, obj2.y);
+assertEquals(43, obj2.x)
+
+try {
+ Object.defineProperty(obj2, "y", {value: 42});
+} catch (e) {
+ assertTrue(/object is not extensible/.test(e));
+}
+
+// obj2.y should still be undefined.
+assertEquals(undefined, obj2.y);
+assertEquals(43, obj2.x);
+
+try {
+ obj2[1] = 42;
+} catch (e) {
+ assertTrue(/object is not extensible/.test(e));
+}
+
+assertEquals(undefined, obj2[1]);
+
+var arr = new Array();
+arr[1] = 10;
+
+Object.preventExtensions(arr);
+
+try {
+ arr[2] = 42;
+ assertUnreachable();
+} catch (e) {
+ assertTrue(/object is not extensible/.test(e));
+}
+assertEquals(10, arr[1]);
+
+// We should still be able to change exiting elements.
+arr[1]= 42;
+assertEquals(42, arr[1]);
+
+
+// Test the the extensible flag is not inherited.
+var parent = {};
+parent.x = 42;
+Object.preventExtensions(parent);
+
+var child = Object.create(parent);
+
+// We should be able to add new properties to the child object.
+child.y = 42;
+
+// This should have no influence on the parent class.
+try {
+ parent.y = 29;
+ assertUnreachable();
+} catch (e) {
+ assertTrue(/object is not extensible/.test(e));
+}
+
+
+// Test that attributes on functions are also handled correctly.
+function foo() {
+ return 42;
+}
+
+Object.preventExtensions(foo);
+
+try {
+ foo.x = 29;
+ assertUnreachable();
+} catch (e) {
+ assertTrue(/object is not extensible/.test(e));
+}
diff --git a/test/mjsunit/regress/regress-45469.js b/test/mjsunit/regress/regress-45469.js
new file mode 100644
index 0000000..832a73f
--- /dev/null
+++ b/test/mjsunit/regress/regress-45469.js
@@ -0,0 +1,46 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test that global regexps capture and fail in the correct cyclic way.
+
+var re = /x/g;
+
+for (var i = 0; i < 15; i++) {
+ assertEquals(i % 3, re.lastIndex, "preindex" + i);
+ var res = re.exec("xx");
+ assertEquals(i % 3 == 2 ? null : ["x"], res, "res" + i);
+}
+
+re = /x/g;
+
+for (var i = 0; i < 15; i++) {
+ assertEquals(i % 3, re.lastIndex, "testpreindex" + i);
+ var res = re.test("xx");
+ assertEquals(i % 3 != 2, res, "testres" + i);
+}
+
+
diff --git a/test/mjsunit/regress/regress-752.js b/test/mjsunit/regress/regress-752.js
new file mode 100644
index 0000000..1142a1f
--- /dev/null
+++ b/test/mjsunit/regress/regress-752.js
@@ -0,0 +1,36 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test that JSON.stringify correctly unwraps Boolean objects.
+
+// See: http://code.google.com/p/v8/issues/detail?id=752
+
+function replacer(key, value) {
+ return value === 42 ? new Boolean(false) : value;
+}
+
+assertEquals(JSON.stringify([42], replacer), "[false]");
diff --git a/test/mjsunit/regress/regress-753.js b/test/mjsunit/regress/regress-753.js
new file mode 100644
index 0000000..6a6d87b
--- /dev/null
+++ b/test/mjsunit/regress/regress-753.js
@@ -0,0 +1,36 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test that JSON.stringify correctly truncates floating point numbers.
+// This test is based on chapter15/15.12/15.12.3/15.12.3-6-a-2.js in the
+// ES5 conformance tests.
+
+// See: http://code.google.com/p/v8/issues/detail?id=753
+
+var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
+assertEquals(JSON.stringify(obj,null, 5.99999), JSON.stringify(obj,null, 5));
+
diff --git a/test/mjsunit/regress/regress-754.js b/test/mjsunit/regress/regress-754.js
new file mode 100644
index 0000000..0b84416
--- /dev/null
+++ b/test/mjsunit/regress/regress-754.js
@@ -0,0 +1,39 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test that Array.prototype.lastIndexOf correctly handles null and undefined
+// as fromIndex argument.
+
+// See: http://code.google.com/p/v8/issues/detail?id=754
+
+var a = new Array(1,2,1);
+assertEquals(1, a.lastIndexOf(2));
+assertEquals(2, a.lastIndexOf(1));
+assertEquals(0, a.lastIndexOf(1, undefined));
+assertEquals(0, a.lastIndexOf(1, null));
+assertEquals(-1, a.lastIndexOf(2, undefined));
+assertEquals(-1, a.lastIndexOf(2, null));
diff --git a/test/mjsunit/smi-ops.js b/test/mjsunit/smi-ops.js
index d5bd214..499535c 100644
--- a/test/mjsunit/smi-ops.js
+++ b/test/mjsunit/smi-ops.js
@@ -685,3 +685,8 @@
assertEquals(24, LeftShiftThreeBy(35));
assertEquals(24, LeftShiftThreeBy(67));
assertEquals(24, LeftShiftThreeBy(-29));
+
+// Regression test for a bug in the ARM code generator. For some register
+// allocations we got the Smi overflow case wrong.
+function f(x, y) { return y + ( 1 << (x & 31)); }
+assertEquals(-2147483647, f(31, 1));
diff --git a/test/mjsunit/store-dictionary.js b/test/mjsunit/store-dictionary.js
new file mode 100644
index 0000000..45e254b
--- /dev/null
+++ b/test/mjsunit/store-dictionary.js
@@ -0,0 +1,65 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Test dictionary store ICs.
+
+// Function that stores property 'x' on an object.
+function store(obj) { obj.x = 42; }
+
+// Create object and force it to dictionary mode by deleting property.
+var o = { x: 32, y: 33 };
+delete o.y;
+
+// Make the store ic in the 'store' function go into dictionary store
+// case.
+for (var i = 0; i < 3; i++) {
+ store(o);
+}
+assertEquals(42, o.x);
+
+// Test that READ_ONLY property attribute is respected. Make 'x'
+// READ_ONLY.
+Object.defineProperty(o, 'x', { value: 32, writable: false });
+
+// Attempt to store using the store ic in the 'store' function.
+store(o);
+
+// Check that the store did not change the value.
+assertEquals(32, o.x);
+
+// Check that bail-out code works.
+// Smi.
+store(1);
+// Fast case object.
+o = new Object();
+store(o);
+assertEquals(42, o.x);
+// Slow case object without x property.
+delete o.x;
+store(o);
+assertEquals(42, o.x);
+
diff --git a/test/mjsunit/to_number_order.js b/test/mjsunit/to_number_order.js
index 1329bad..d17e600 100644
--- a/test/mjsunit/to_number_order.js
+++ b/test/mjsunit/to_number_order.js
@@ -40,6 +40,14 @@
assertEquals("hestfisk", x, "max");
x = "";
+assertEquals(1, Math.max(v,v));
+assertEquals("hesthest", x, "max_identical");
+
+x = "";
+assertEquals(2, Math.min(w,w));
+assertEquals("fiskfisk", x, "max");
+
+x = "";
assertEquals(Math.atan2(1, 2), Math.atan2(v, w));
// JSC says fiskhest.
assertEquals("hestfisk", x, "atan2");
@@ -122,8 +130,86 @@
new Date().setUTCFullYear(year, month, date, hours, minutes, seconds, ms);
assertEquals("123", x, "Date.setUTCFullYear");
+x = "";
var a = { valueOf: function() { x += "hest"; return 97; } };
var b = { valueOf: function() { x += "fisk"; return 98; } };
assertEquals("ab", String.fromCharCode(a, b), "String.fromCharCode");
+assertEquals("hestfisk", x, "String.fromCharCode valueOf order");
+
+
+
+// Test whether valueOf is called when comparing identical objects
+x = "";
+assertTrue(a < b, "Compare objects a < b");
+assertEquals("hestfisk", x, "Compare objects a < b valueOf order");
+
+x = "";
+assertFalse(a < a, "Compare objects a < a");
+// assertEquals("hesthest", x, "Compare objects a < a valueOf order");
+
+x = "";
+assertTrue(a == a, "Compare objects a == a");
+assertEquals("", x, "Compare objects a == a valueOf not called");
+
+x = "";
+assertFalse(b > b, "Compare objects b > b");
+assertEquals("fiskfisk", x, "Compare objects b > b valueOf order");
+
+x = "";
+assertTrue(b >= b, "Compare objects b >= b");
+assertEquals("fiskfisk", x, "Compare objects b >= b valueOf order");
+
+x = "";
+assertFalse(a > b, "Compare objects a > b");
+assertEquals("fiskhest", x, "Compare objects a > b valueOf order");
+
+x = "";
+assertFalse(a > void(0), "Compare objects a > undefined");
+assertEquals("hest", x, "Compare objects a > undefined valueOf order");
+
+x = "";
+assertFalse(void(0) > b, "Compare objects undefined > b");
+assertEquals("fisk", x, "Compare objects undefined > b valueOf order");
+
+
+function identical_object_comparison() {
+ x = "";
+ assertTrue(a < b, "Compare objects a < b");
+ assertEquals("hestfisk", x, "Compare objects a < b valueOf order");
+
+ x = "";
+ assertFalse(a < a, "Compare objects a < a");
+ // assertEquals("hesthest", x, "Compare objects a < a valueOf order");
+
+ x = "";
+ assertTrue(a == a, "Compare objects a == a");
+ assertEquals("", x, "Compare objects a == a valueOf not called");
+
+ x = "";
+ assertFalse(b > b, "Compare objects b > b");
+ assertEquals("fiskfisk", x, "Compare objects b > b valueOf order");
+
+ x = "";
+ assertTrue(b >= b, "Compare objects b >= b");
+ assertEquals("fiskfisk", x, "Compare objects b >= b valueOf order");
+
+ x = "";
+ assertFalse(a > b, "Compare objects a > b");
+ assertEquals("fiskhest", x, "Compare objects a > b valueOf order");
+
+ x = "";
+ assertFalse(a > void(0), "Compare objects a > undefined");
+ assertEquals("hest", x, "Compare objects a > undefined valueOf order");
+
+ x = "";
+ assertFalse(void(0) > b, "Compare objects undefined > b");
+ assertEquals("fisk", x, "Compare objects undefined > b valueOf order");
+}
+
+// Call inside loop to test optimization and possible caching.
+for (i = 0; i < 3; ++i) {
+ identical_object_comparison();
+}
+
print("ok");
diff --git a/test/mozilla/mozilla.status b/test/mozilla/mozilla.status
index b4ec444..28fc063 100644
--- a/test/mozilla/mozilla.status
+++ b/test/mozilla/mozilla.status
@@ -26,13 +26,13 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This file is up to date with respect to Mozilla's CVS repository as of
-# 2008-09-02. If new tests are added to Mozilla's CVS it may need to be
+# 2010-06-29. If new tests are added to Mozilla's CVS it may need to be
# updated.
# To get the mozilla tests:
# cd /path/to/checkout/test/mozilla
# rm -rf data
-# cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -D 2008-09-02 mozilla/js/tests
+# cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -D 2010-06-29 mozilla/js/tests
# mv mozilla/js/tests data
# rm -rf mozilla
@@ -53,6 +53,10 @@
js1_5/Regress/regress-271716-n: SKIP
+# This test uses a unitialized variable. A Bug has been filed:
+# https://bugzilla.mozilla.org/show_bug.cgi?id=575575
+js1_5/Array/regress-465980-02: SKIP
+
# These tests are simply wrong (i.e., they do not test what they intend
# to test).
# In particular, these two compare numbers to NaN with != in the current
@@ -226,6 +230,10 @@
# toPrecision argument restricted to range 1..21 in JSC/V8
js1_5/Regress/regress-452346: FAIL_OK
+ecma_3/Number/15.7.4.7-1: FAIL_OK
+
+# toExponential argument restricted to range 0..20 in JSC/V8
+ecma_3/Number/15.7.4.6-1: FAIL_OK
# Array.prototype.slice with zero arguments return undefined in JSC/V8,
# empty array in Spider/TraceMonkey.
@@ -234,8 +242,9 @@
#:=== RegExp:===
# To be compatible with JSC we silently ignore flags that do not make
-# sense. This test expects us to throw exceptions.
+# sense. These tests expects us to throw exceptions.
ecma_3/RegExp/regress-57631: FAIL_OK
+ecma_3/RegExp/15.10.4.1-6: FAIL_OK
# PCRE doesn't allow subpattern nesting deeper than 200, this tests
# depth 500. JSC detects the case, and return null from the match,
@@ -315,6 +324,11 @@
js1_5/Regress/regress-320119: FAIL_OK
+# We do not recognize a multiline comment as newline character.
+# We are compatible with JSC.
+ecma_3/LexicalConventions/7.4-01: FAIL_OK
+
+
# No support for toSource().
js1_5/Regress/regress-248444: FAIL_OK
js1_5/Regress/regress-313967-01: FAIL_OK
@@ -347,6 +361,7 @@
# print strings for errors. Non-ECMA behavior.
js1_2/function/tostring-2: FAIL_OK
js1_2/Objects/toString-001: FAIL_OK
+js1_5/LexicalConventions/regress-469940: FAIL_OK
js1_5/Exceptions/regress-332472: FAIL_OK
js1_5/Regress/regress-173067: FAIL_OK
js1_5/Regress/regress-355556: FAIL_OK
@@ -386,11 +401,7 @@
# Tests that use uneval. Non-ECMA.
js1_5/GC/regress-418128: FAIL_OK
js1_5/extensions/regress-465276: FAIL_OK
-
-
-# Tests that use __count__. Non-ECMA.
-js1_5/extensions/regress-434837-01: FAIL_OK
-
+js1_5/Error/regress-465377: FAIL_OK
# Tests that use the watch method. Non-ECMA.
js1_5/extensions/regress-435345-01: FAIL_OK
@@ -432,6 +443,7 @@
js1_5/Object/regress-362872-02: FAIL_OK
js1_5/Regress/regress-361467: FAIL_OK
js1_5/Regress/regress-385393-06: FAIL_OK
+js1_5/Regress/regress-506567: FAIL_OK
# Use special Mozilla getter/setter syntax
@@ -484,6 +496,11 @@
# The concat() method is defined in Array.prototype; not Array.
js1_5/Array/regress-313153: FAIL_OK
+# The join() method is defined on Array.prototype; not Array.
+js1_5/Array/regress-474529: FAIL_OK
+
+# The lastIndexOf() method is defined on Array.prototype, not Array.
+ecma_3/Array/15.5.4.8-01: FAIL_OK
# Properties fileName, and lineNumber of Error instances are
# not supported. Mozilla specific extension.
@@ -552,6 +569,10 @@
js1_5/Regress/regress-417893: FAIL_OK
+# Unsupported use of "[]" as function parameter. We match JSC.
+js1_5/Regress/regress-416737-01: FAIL_OK
+js1_5/Regress/regress-416737-02: FAIL_OK
+
##################### FAILING TESTS #####################
@@ -596,6 +617,11 @@
# Marked as: Will not fix. V8 throws an acceptable RangeError.
js1_5/Expressions/regress-394673: FAIL
+
+# Bug 762: http://code.google.com/p/v8/issues/detail?id=762
+# We do not correctly handle assignments within "with"
+/ecma_3/Statements/12.10-01: FAIL
+
##################### MOZILLA EXTENSION TESTS #####################
ecma/extensions/15.1.2.1-1: FAIL_OK
@@ -674,6 +700,9 @@
js1_5/extensions/regress-367630: FAIL_OK
js1_5/extensions/regress-367923: FAIL_OK
js1_5/extensions/regress-368859: FAIL_OK
+js1_5/extensions/regress-369696-01: FAIL_OK
+js1_5/extensions/regress-369696-02: FAIL_OK
+js1_5/extensions/regress-369696-03: FAIL_OK
js1_5/extensions/regress-374589: FAIL_OK
js1_5/extensions/regress-375801: FAIL_OK
js1_5/extensions/regress-376052: FAIL_OK
@@ -693,6 +722,11 @@
js1_5/extensions/regress-420869-01: FAIL_OK
js1_5/extensions/regress-424257: FAIL_OK
js1_5/extensions/regress-424683-01: FAIL_OK
+js1_5/extensions/regress-429739: FAIL_OK
+js1_5/extensions/regress-454142: FAIL_OK
+js1_5/extensions/regress-465145: FAIL_OK
+js1_5/extensions/regress-469625: FAIL_OK
+js1_5/extensions/regress-472787: FAIL_OK
js1_5/extensions/regress-44009: FAIL_OK
js1_5/extensions/regress-50447-1: FAIL_OK
js1_5/extensions/regress-50447: FAIL_OK
@@ -771,7 +805,7 @@
js1_5/decompilation/regress-376564: PASS || FAIL
js1_5/decompilation/regress-383721: PASS || FAIL
js1_5/decompilation/regress-406555: PASS || FAIL
-
+js1_5/decompilation/regress-460870: PASS || FAIL
# These tests take an unreasonable amount of time so we skip them
# in fast mode.