Update V8 to r7079 as required by WebKit r80534.
Change-Id: I487c152e485d5a40b68997d7c0d2f1fba5da0834
diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status
index a7422c2..e573eb2 100644
--- a/test/cctest/cctest.status
+++ b/test/cctest/cctest.status
@@ -47,29 +47,8 @@
test-serialize/DependentTestThatAlwaysFails: FAIL
##############################################################################
-[ $arch == x64 ]
-
-# Optimization is currently not working on crankshaft x64 and ARM.
-test-heap/TestInternalWeakLists: PASS || FAIL
-test-heap/TestInternalWeakListsTraverseWithGC: PASS || FAIL
-
-
-##############################################################################
-[ $arch == x64 && $crankshaft ]
-
-# Tests that fail with crankshaft.
-test-deoptimization/DeoptimizeBinaryOperationMOD: FAIL
-test-deoptimization/DeoptimizeLoadICStoreIC: FAIL
-test-deoptimization/DeoptimizeLoadICStoreICNested: FAIL
-test-deoptimization/DeoptimizeCompare: PASS || FAIL
-
-##############################################################################
[ $arch == arm ]
-# Optimization is currently not working on crankshaft x64 and ARM.
-test-heap/TestInternalWeakLists: PASS || FAIL
-test-heap/TestInternalWeakListsTraverseWithGC: PASS || FAIL
-
# We cannot assume that we can throw OutOfMemory exceptions in all situations.
# Apparently our ARM box is in such a state. Skip the test as it also runs for
# a long time.
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index b92185f..cd26412 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -2691,6 +2691,41 @@
}
+THREADED_TEST(TryCatchAndFinallyHidingException) {
+ v8::HandleScope scope;
+ LocalContext context;
+ v8::TryCatch try_catch;
+ CHECK(!try_catch.HasCaught());
+ CompileRun("function f(k) { try { this[k]; } finally { return 0; } };");
+ CompileRun("f({toString: function() { throw 42; }});");
+ CHECK(!try_catch.HasCaught());
+}
+
+
+v8::Handle<v8::Value> WithTryCatch(const v8::Arguments& args) {
+ v8::TryCatch try_catch;
+ return v8::Undefined();
+}
+
+
+THREADED_TEST(TryCatchAndFinally) {
+ v8::HandleScope scope;
+ LocalContext context;
+ context->Global()->Set(
+ v8_str("native_with_try_catch"),
+ v8::FunctionTemplate::New(WithTryCatch)->GetFunction());
+ v8::TryCatch try_catch;
+ CHECK(!try_catch.HasCaught());
+ CompileRun(
+ "try {\n"
+ " throw new Error('a');\n"
+ "} finally {\n"
+ " native_with_try_catch();\n"
+ "}\n");
+ CHECK(try_catch.HasCaught());
+}
+
+
THREADED_TEST(Equality) {
v8::HandleScope scope;
LocalContext context;
@@ -5617,6 +5652,56 @@
}
+TEST(AccessControlES5) {
+ v8::HandleScope handle_scope;
+ v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
+
+ global_template->SetAccessCheckCallbacks(NamedAccessBlocker,
+ IndexedAccessBlocker);
+
+ // Add an accessor that is not accessible by cross-domain JS code.
+ global_template->SetAccessor(v8_str("blocked_prop"),
+ UnreachableGetter, UnreachableSetter,
+ v8::Handle<Value>(),
+ v8::DEFAULT);
+
+ // Create an environment
+ v8::Persistent<Context> context0 = Context::New(NULL, global_template);
+ context0->Enter();
+
+ v8::Handle<v8::Object> global0 = context0->Global();
+
+ v8::Persistent<Context> context1 = Context::New();
+ context1->Enter();
+ v8::Handle<v8::Object> global1 = context1->Global();
+ global1->Set(v8_str("other"), global0);
+
+ // Regression test for issue 1154.
+ ExpectTrue("Object.keys(other).indexOf('blocked_prop') == -1");
+
+ ExpectUndefined("other.blocked_prop");
+
+ // Regression test for issue 1027.
+ CompileRun("Object.defineProperty(\n"
+ " other, 'blocked_prop', {configurable: false})");
+ ExpectUndefined("other.blocked_prop");
+ ExpectUndefined(
+ "Object.getOwnPropertyDescriptor(other, 'blocked_prop')");
+
+ // Regression test for issue 1171.
+ ExpectTrue("Object.isExtensible(other)");
+ CompileRun("Object.preventExtensions(other)");
+ ExpectTrue("Object.isExtensible(other)");
+
+ // Object.seal and Object.freeze.
+ CompileRun("Object.freeze(other)");
+ ExpectTrue("Object.isExtensible(other)");
+
+ CompileRun("Object.seal(other)");
+ ExpectTrue("Object.isExtensible(other)");
+}
+
+
static bool GetOwnPropertyNamesNamedBlocker(Local<v8::Object> global,
Local<Value> name,
v8::AccessType type,
@@ -7542,10 +7627,11 @@
"garbage = undefined;");
}
+
v8::Handle<v8::Value> DirectApiCallback(const v8::Arguments& args) {
static int count = 0;
if (count++ % 3 == 0) {
- v8::V8::LowMemoryNotification(); // This should move the stub
+ i::Heap::CollectAllGarbage(true); // This should move the stub
GenerateSomeGarbage(); // This should ensure the old stub memory is flushed
}
return v8::Handle<v8::Value>();
@@ -7597,6 +7683,54 @@
}
+v8::Handle<v8::Value> DirectGetterCallback(Local<String> name,
+ const v8::AccessorInfo& info) {
+ if (++p_getter_count % 3 == 0) {
+ i::Heap::CollectAllGarbage(true);
+ GenerateSomeGarbage();
+ }
+ return v8::Handle<v8::Value>();
+}
+
+
+THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) {
+ v8::HandleScope scope;
+ LocalContext context;
+ v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New();
+ obj->SetAccessor(v8_str("p1"), DirectGetterCallback);
+ context->Global()->Set(v8_str("o1"), obj->NewInstance());
+ p_getter_count = 0;
+ CompileRun(
+ "function f() {"
+ " for (var i = 0; i < 30; i++) o1.p1;"
+ "}"
+ "f();");
+ CHECK_EQ(30, p_getter_count);
+}
+
+
+v8::Handle<v8::Value> ThrowingDirectGetterCallback(
+ Local<String> name, const v8::AccessorInfo& info) {
+ return v8::ThrowException(v8_str("g"));
+}
+
+
+THREADED_TEST(LoadICFastApi_DirectCall_Throw) {
+ v8::HandleScope scope;
+ LocalContext context;
+ v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New();
+ obj->SetAccessor(v8_str("p1"), ThrowingDirectGetterCallback);
+ context->Global()->Set(v8_str("o1"), obj->NewInstance());
+ v8::Handle<Value> result = CompileRun(
+ "var result = '';"
+ "for (var i = 0; i < 5; i++) {"
+ " try { o1.p1; } catch (e) { result += e; }"
+ "}"
+ "result;");
+ CHECK_EQ(v8_str("ggggg"), result);
+}
+
+
THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) {
int interceptor_call_count = 0;
v8::HandleScope scope;
@@ -9957,10 +10091,11 @@
// Inject the input as a global variable.
i::Handle<i::String> input_name =
i::Factory::NewStringFromAscii(i::Vector<const char>("input", 5));
- i::Top::global_context()->global()->SetProperty(*input_name,
- *input_,
- NONE)->ToObjectChecked();
-
+ i::Top::global_context()->global()->SetProperty(
+ *input_name,
+ *input_,
+ NONE,
+ i::kNonStrictMode)->ToObjectChecked();
MorphThread morph_thread(this);
morph_thread.Start();
@@ -10482,14 +10617,14 @@
CHECK_EQ(28, result->Int32Value());
i::Handle<i::Smi> value(i::Smi::FromInt(2));
- i::SetElement(jsobj, 1, value);
+ i::SetElement(jsobj, 1, value, i::kNonStrictMode);
CHECK_EQ(2, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
*value.location() = i::Smi::FromInt(256);
- i::SetElement(jsobj, 1, value);
+ i::SetElement(jsobj, 1, value, i::kNonStrictMode);
CHECK_EQ(255,
i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
*value.location() = i::Smi::FromInt(-1);
- i::SetElement(jsobj, 1, value);
+ i::SetElement(jsobj, 1, value, i::kNonStrictMode);
CHECK_EQ(0, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value());
result = CompileRun("for (var i = 0; i < 8; i++) {"
@@ -10691,7 +10826,62 @@
"result");
CHECK_EQ(32640, result->Int32Value());
- // Make sure that pixel array loads are optimized by crankshaft.
+ // Make sure that pixel array store ICs clamp values correctly.
+ result = CompileRun("function pa_store(p) {"
+ " for (var j = 0; j < 256; j++) { p[j] = j * 2; }"
+ "}"
+ "pa_store(pixels);"
+ "var sum = 0;"
+ "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
+ "sum");
+ CHECK_EQ(48896, result->Int32Value());
+
+ // Make sure that pixel array stores correctly handle accesses outside
+ // of the pixel array..
+ result = CompileRun("function pa_store(p,start) {"
+ " for (var j = 0; j < 256; j++) {"
+ " p[j+start] = j * 2;"
+ " }"
+ "}"
+ "pa_store(pixels,0);"
+ "pa_store(pixels,-128);"
+ "var sum = 0;"
+ "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
+ "sum");
+ CHECK_EQ(65280, result->Int32Value());
+
+ // Make sure that the generic store stub correctly handle accesses outside
+ // of the pixel array..
+ result = CompileRun("function pa_store(p,start) {"
+ " for (var j = 0; j < 256; j++) {"
+ " p[j+start] = j * 2;"
+ " }"
+ "}"
+ "pa_store(pixels,0);"
+ "just_ints = new Object();"
+ "for (var i = 0; i < 256; ++i) { just_ints[i] = i; }"
+ "pa_store(just_ints, 0);"
+ "pa_store(pixels,-128);"
+ "var sum = 0;"
+ "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
+ "sum");
+ CHECK_EQ(65280, result->Int32Value());
+
+ // Make sure that the generic keyed store stub clamps pixel array values
+ // correctly.
+ result = CompileRun("function pa_store(p) {"
+ " for (var j = 0; j < 256; j++) { p[j] = j * 2; }"
+ "}"
+ "pa_store(pixels);"
+ "just_ints = new Object();"
+ "pa_store(just_ints);"
+ "pa_store(pixels);"
+ "var sum = 0;"
+ "for (var j = 0; j < 256; j++) { sum += pixels[j]; }"
+ "sum");
+ CHECK_EQ(48896, result->Int32Value());
+
+ // Make sure that pixel array loads are optimized by crankshaft.
result = CompileRun("function pa_load(p) {"
" var sum = 0;"
" for (var i=0; i<256; ++i) {"
@@ -10706,6 +10896,24 @@
"result");
CHECK_EQ(32640, result->Int32Value());
+ // Make sure that pixel array stores are optimized by crankshaft.
+ result = CompileRun("function pa_init(p) {"
+ "for (var i = 0; i < 256; ++i) { p[i] = i; }"
+ "}"
+ "function pa_load(p) {"
+ " var sum = 0;"
+ " for (var i=0; i<256; ++i) {"
+ " sum += p[i];"
+ " }"
+ " return sum; "
+ "}"
+ "for (var i = 0; i < 100000; ++i) {"
+ " pa_init(pixels);"
+ "}"
+ "result = pa_load(pixels);"
+ "result");
+ CHECK_EQ(32640, result->Int32Value());
+
free(pixel_data);
}
@@ -10725,6 +10933,53 @@
}
+static v8::Handle<Value> NotHandledIndexedPropertyGetter(
+ uint32_t index,
+ const AccessorInfo& info) {
+ ApiTestFuzzer::Fuzz();
+ return v8::Handle<Value>();
+}
+
+
+static v8::Handle<Value> NotHandledIndexedPropertySetter(
+ uint32_t index,
+ Local<Value> value,
+ const AccessorInfo& info) {
+ ApiTestFuzzer::Fuzz();
+ return v8::Handle<Value>();
+}
+
+
+THREADED_TEST(PixelArrayWithInterceptor) {
+ v8::HandleScope scope;
+ LocalContext context;
+ const int kElementCount = 260;
+ uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
+ i::Handle<i::PixelArray> pixels =
+ i::Factory::NewPixelArray(kElementCount, pixel_data);
+ for (int i = 0; i < kElementCount; i++) {
+ pixels->set(i, i % 256);
+ }
+ v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New();
+ templ->SetIndexedPropertyHandler(NotHandledIndexedPropertyGetter,
+ NotHandledIndexedPropertySetter);
+ v8::Handle<v8::Object> obj = templ->NewInstance();
+ obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount);
+ context->Global()->Set(v8_str("pixels"), obj);
+ v8::Handle<v8::Value> result = CompileRun("pixels[1]");
+ CHECK_EQ(1, result->Int32Value());
+ result = CompileRun("var sum = 0;"
+ "for (var i = 0; i < 8; i++) {"
+ " sum += pixels[i] = pixels[i] = -i;"
+ "}"
+ "sum;");
+ CHECK_EQ(-28, result->Int32Value());
+ result = CompileRun("pixels.hasOwnProperty('1')");
+ CHECK(result->BooleanValue());
+ free(pixel_data);
+}
+
+
static int ExternalArrayElementSize(v8::ExternalArrayType array_type) {
switch (array_type) {
case v8::kExternalByteArray:
diff --git a/test/cctest/test-compiler.cc b/test/cctest/test-compiler.cc
index b424b7f..9f21b78 100644
--- a/test/cctest/test-compiler.cc
+++ b/test/cctest/test-compiler.cc
@@ -108,7 +108,7 @@
Handle<Object> object(value);
Handle<String> symbol = Factory::LookupAsciiSymbol(name);
Handle<JSObject> global(Top::context()->global());
- SetProperty(global, symbol, object, NONE);
+ SetProperty(global, symbol, object, NONE, kNonStrictMode);
}
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc
index 239d8ae..7f06bc3 100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -50,7 +50,7 @@
i::Address frame3 = NULL) {
i::TickSample* sample = proc->TickSampleEvent();
sample->pc = frame1;
- sample->function = frame1;
+ sample->tos = frame1;
sample->frames_count = 0;
if (frame2 != NULL) {
sample->stack[0] = frame2;
@@ -103,7 +103,8 @@
i::Heap::empty_string(),
0,
ToAddress(0x1000),
- 0x100);
+ 0x100,
+ ToAddress(0x10000));
processor.CodeCreateEvent(i::Logger::BUILTIN_TAG,
"bbb",
ToAddress(0x1200),
@@ -116,8 +117,6 @@
processor.CodeMoveEvent(ToAddress(0x1400), ToAddress(0x1500));
processor.CodeCreateEvent(i::Logger::STUB_TAG, 3, ToAddress(0x1600), 0x10);
processor.CodeDeleteEvent(ToAddress(0x1600));
- processor.FunctionCreateEvent(ToAddress(0x1700), ToAddress(0x1000),
- TokenEnumerator::kNoSecurityToken);
// Enqueue a tick event to enable code events processing.
EnqueueTickSampleEvent(&processor, ToAddress(0x1000));
@@ -139,9 +138,6 @@
CHECK_NE(NULL, entry4);
CHECK_EQ("ddd", entry4->name());
CHECK_EQ(NULL, generator.code_map()->FindEntry(ToAddress(0x1600)));
- CodeEntry* entry5 = generator.code_map()->FindEntry(ToAddress(0x1700));
- CHECK_NE(NULL, entry5);
- CHECK_EQ(aaa_str, entry5->name());
}
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 441aae6..7245e54 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -153,7 +153,8 @@
Handle<v8::internal::String> debug_string =
v8::internal::Factory::LookupAsciiSymbol("debug");
SetProperty(global, debug_string,
- Handle<Object>(Debug::debug_context()->global_proxy()), DONT_ENUM);
+ Handle<Object>(Debug::debug_context()->global_proxy()), DONT_ENUM,
+ ::v8::internal::kNonStrictMode);
}
private:
v8::Persistent<v8::Context> context_;
diff --git a/test/cctest/test-decls.cc b/test/cctest/test-decls.cc
index 88fa79b..6ea4c84 100644
--- a/test/cctest/test-decls.cc
+++ b/test/cctest/test-decls.cc
@@ -223,7 +223,7 @@
{ DeclarationContext context;
context.Check("function x() { }; x",
1, // access
- 1, // declaration
+ 0,
0,
EXPECT_RESULT);
}
@@ -278,7 +278,7 @@
{ PresentPropertyContext context;
context.Check("function x() { }; x",
1, // access
- 1, // declaration
+ 0,
0,
EXPECT_RESULT);
}
@@ -332,7 +332,7 @@
{ AbsentPropertyContext context;
context.Check("function x() { }; x",
1, // access
- 1, // declaration
+ 0,
0,
EXPECT_RESULT);
}
@@ -422,7 +422,7 @@
{ AppearingPropertyContext context;
context.Check("function x() { }; x",
1, // access
- 1, // declaration
+ 0,
0,
EXPECT_RESULT);
}
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index a23ee17..4cc7f8b 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -212,13 +212,14 @@
Handle<Map> initial_map =
Factory::NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
function->set_initial_map(*initial_map);
- Top::context()->global()->SetProperty(*name,
- *function,
- NONE)->ToObjectChecked();
+ Top::context()->global()->SetProperty(
+ *name, *function, NONE, kNonStrictMode)->ToObjectChecked();
// Allocate an object. Unrooted after leaving the scope.
Handle<JSObject> obj = Factory::NewJSObject(function);
- obj->SetProperty(*prop_name, Smi::FromInt(23), NONE)->ToObjectChecked();
- obj->SetProperty(*prop_namex, Smi::FromInt(24), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
+ obj->SetProperty(
+ *prop_namex, Smi::FromInt(24), NONE, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
CHECK_EQ(Smi::FromInt(24), obj->GetProperty(*prop_namex));
@@ -238,10 +239,10 @@
HandleScope inner_scope;
// Allocate another object, make it reachable from global.
Handle<JSObject> obj = Factory::NewJSObject(function);
- Top::context()->global()->SetProperty(*obj_name,
- *obj,
- NONE)->ToObjectChecked();
- obj->SetProperty(*prop_name, Smi::FromInt(23), NONE)->ToObjectChecked();
+ Top::context()->global()->SetProperty(
+ *obj_name, *obj, NONE, kNonStrictMode)->ToObjectChecked();
+ obj->SetProperty(
+ *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
}
// After gc, it should survive.
@@ -540,12 +541,12 @@
Handle<String> prop_name = Factory::LookupAsciiSymbol("theSlot");
Handle<JSObject> obj = Factory::NewJSObject(function);
- obj->SetProperty(*prop_name, Smi::FromInt(23), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
// Check that we can add properties to function objects.
- function->SetProperty(*prop_name,
- Smi::FromInt(24),
- NONE)->ToObjectChecked();
+ function->SetProperty(
+ *prop_name, Smi::FromInt(24), NONE, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name));
}
@@ -567,7 +568,8 @@
CHECK(!obj->HasLocalProperty(*first));
// add first
- obj->SetProperty(*first, Smi::FromInt(1), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
CHECK(obj->HasLocalProperty(*first));
// delete first
@@ -575,8 +577,10 @@
CHECK(!obj->HasLocalProperty(*first));
// add first and then second
- obj->SetProperty(*first, Smi::FromInt(1), NONE)->ToObjectChecked();
- obj->SetProperty(*second, Smi::FromInt(2), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
+ obj->SetProperty(
+ *second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
CHECK(obj->HasLocalProperty(*first));
CHECK(obj->HasLocalProperty(*second));
@@ -588,8 +592,10 @@
CHECK(!obj->HasLocalProperty(*second));
// add first and then second
- obj->SetProperty(*first, Smi::FromInt(1), NONE)->ToObjectChecked();
- obj->SetProperty(*second, Smi::FromInt(2), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
+ obj->SetProperty(
+ *second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
CHECK(obj->HasLocalProperty(*first));
CHECK(obj->HasLocalProperty(*second));
@@ -603,14 +609,16 @@
// check string and symbol match
static const char* string1 = "fisk";
Handle<String> s1 = Factory::NewStringFromAscii(CStrVector(string1));
- obj->SetProperty(*s1, Smi::FromInt(1), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *s1, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
Handle<String> s1_symbol = Factory::LookupAsciiSymbol(string1);
CHECK(obj->HasLocalProperty(*s1_symbol));
// check symbol and string match
static const char* string2 = "fugl";
Handle<String> s2_symbol = Factory::LookupAsciiSymbol(string2);
- obj->SetProperty(*s2_symbol, Smi::FromInt(1), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *s2_symbol, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
Handle<String> s2 = Factory::NewStringFromAscii(CStrVector(string2));
CHECK(obj->HasLocalProperty(*s2));
}
@@ -631,7 +639,8 @@
Handle<JSObject> obj = Factory::NewJSObject(function);
// Set a propery
- obj->SetProperty(*prop_name, Smi::FromInt(23), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *prop_name, Smi::FromInt(23), NONE, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
// Check the map has changed
@@ -661,7 +670,7 @@
CHECK(array->HasFastElements()); // Must be in fast mode.
// array[length] = name.
- ok = array->SetElement(0, *name)->ToObjectChecked();
+ ok = array->SetElement(0, *name, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(Smi::FromInt(1), array->length());
CHECK_EQ(array->GetElement(0), *name);
@@ -676,7 +685,7 @@
CHECK(array->HasDictionaryElements()); // Must be in slow mode.
// array[length] = name.
- ok = array->SetElement(int_length, *name)->ToObjectChecked();
+ ok = array->SetElement(int_length, *name, kNonStrictMode)->ToObjectChecked();
uint32_t new_int_length = 0;
CHECK(array->length()->ToArrayIndex(&new_int_length));
CHECK_EQ(static_cast<double>(int_length), new_int_length - 1);
@@ -698,12 +707,14 @@
Handle<String> first = Factory::LookupAsciiSymbol("first");
Handle<String> second = Factory::LookupAsciiSymbol("second");
- obj->SetProperty(*first, Smi::FromInt(1), NONE)->ToObjectChecked();
- obj->SetProperty(*second, Smi::FromInt(2), NONE)->ToObjectChecked();
+ obj->SetProperty(
+ *first, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
+ obj->SetProperty(
+ *second, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
- Object* ok = obj->SetElement(0, *first)->ToObjectChecked();
+ Object* ok = obj->SetElement(0, *first, kNonStrictMode)->ToObjectChecked();
- ok = obj->SetElement(1, *second)->ToObjectChecked();
+ ok = obj->SetElement(1, *second, kNonStrictMode)->ToObjectChecked();
// Make the clone.
Handle<JSObject> clone = Copy(obj);
@@ -716,11 +727,13 @@
CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second));
// Flip the values.
- clone->SetProperty(*first, Smi::FromInt(2), NONE)->ToObjectChecked();
- clone->SetProperty(*second, Smi::FromInt(1), NONE)->ToObjectChecked();
+ clone->SetProperty(
+ *first, Smi::FromInt(2), NONE, kNonStrictMode)->ToObjectChecked();
+ clone->SetProperty(
+ *second, Smi::FromInt(1), NONE, kNonStrictMode)->ToObjectChecked();
- ok = clone->SetElement(0, *second)->ToObjectChecked();
- ok = clone->SetElement(1, *first)->ToObjectChecked();
+ ok = clone->SetElement(0, *second, kNonStrictMode)->ToObjectChecked();
+ ok = clone->SetElement(1, *first, kNonStrictMode)->ToObjectChecked();
CHECK_EQ(obj->GetElement(1), clone->GetElement(0));
CHECK_EQ(obj->GetElement(0), clone->GetElement(1));
diff --git a/test/cctest/test-log-stack-tracer.cc b/test/cctest/test-log-stack-tracer.cc
index c85f6c0..bf72184 100644
--- a/test/cctest/test-log-stack-tracer.cc
+++ b/test/cctest/test-log-stack-tracer.cc
@@ -33,6 +33,7 @@
#include "v8.h"
+#include "api.h"
#include "codegen.h"
#include "log.h"
#include "top.h"
@@ -200,16 +201,16 @@
}
-static void CheckJSFunctionAtAddress(const char* func_name, Address addr) {
- CHECK(i::Heap::Contains(addr));
- i::Object* obj = i::HeapObject::FromAddress(addr);
- CHECK(obj->IsJSFunction());
- CHECK(JSFunction::cast(obj)->shared()->name()->IsString());
- i::SmartPointer<char> found_name =
- i::String::cast(
- JSFunction::cast(
- obj)->shared()->name())->ToCString();
- CHECK_EQ(func_name, *found_name);
+static bool IsAddressWithinFuncCode(JSFunction* function, Address addr) {
+ i::Code* code = function->code();
+ return code->contains(addr);
+}
+
+static bool IsAddressWithinFuncCode(const char* func_name, Address addr) {
+ v8::Local<v8::Value> func = env->Global()->Get(v8_str(func_name));
+ CHECK(func->IsFunction());
+ JSFunction* js_func = JSFunction::cast(*v8::Utils::OpenHandle(*func));
+ return IsAddressWithinFuncCode(js_func, addr);
}
@@ -309,8 +310,8 @@
// Stack tracing will start from the first JS function, i.e. "JSFuncDoTrace"
CHECK_GT(sample.frames_count, base + 1);
- CheckJSFunctionAtAddress("JSFuncDoTrace", sample.stack[base + 0]);
- CheckJSFunctionAtAddress("JSTrace", sample.stack[base + 1]);
+ CHECK(IsAddressWithinFuncCode("JSFuncDoTrace", sample.stack[base + 0]));
+ CHECK(IsAddressWithinFuncCode("JSTrace", sample.stack[base + 1]));
}
@@ -351,9 +352,6 @@
// DoTraceHideCEntryFPAddress(EBP) [native]
// StackTracer::Trace
//
- // The last JS function called. It is only visible through
- // sample.function, as its return address is above captured EBP value.
- CheckJSFunctionAtAddress("JSFuncDoTrace", sample.function);
// The VM state tracking keeps track of external callbacks and puts
// them at the top of the sample stack.
@@ -363,8 +361,8 @@
// Stack sampling will start from the caller of JSFuncDoTrace, i.e. "JSTrace"
CHECK_GT(sample.frames_count, base + 1);
- CheckJSFunctionAtAddress("JSTrace", sample.stack[base + 0]);
- CheckJSFunctionAtAddress("OuterJSTrace", sample.stack[base + 1]);
+ CHECK(IsAddressWithinFuncCode("JSTrace", sample.stack[base + 0]));
+ CHECK(IsAddressWithinFuncCode("OuterJSTrace", sample.stack[base + 1]));
}
diff --git a/test/cctest/test-log.cc b/test/cctest/test-log.cc
index 032a183..30b8a48 100644
--- a/test/cctest/test-log.cc
+++ b/test/cctest/test-log.cc
@@ -1053,10 +1053,10 @@
// Skip size.
ref_s = strchr(ref_s, ',') + 1;
new_s = strchr(new_s, ',') + 1;
- int ref_len = StrChrLen(ref_s, '\n');
- int new_len = StrChrLen(new_s, '\n');
- // If reference is anonymous (""), it's OK to have anything in new.
- if (ref_len == 2) return true;
+ CHECK_EQ('"', ref_s[0]);
+ CHECK_EQ('"', new_s[0]);
+ int ref_len = StrChrLen(ref_s + 1, '\"');
+ int new_len = StrChrLen(new_s + 1, '\"');
// A special case for ErrorPrototype. Haven't yet figured out why they
// are different.
const char* error_prototype = "\"ErrorPrototype";
@@ -1074,21 +1074,6 @@
return true;
}
}
- // Code objects can change their optimizability: code object may start
- // as optimizable, but later be discovered to be actually not optimizable.
- // Alas, we don't record this info as of now, so we allow cases when
- // ref is thought to be optimizable while traverse finds it to be
- // not optimizable.
- if (ref_s[1] == '~') { // Code object used to be optimizable
- if (new_s[1] == ' ') { // ...but later was set unoptimizable.
- CHECK_EQ('"', ref_s[0]);
- CHECK_EQ('"', new_s[0]);
- ref_s += 2; // Cut the leading quote and the marker
- ref_len -= 2;
- new_s += 1; // Cut the leading quote only.
- new_len -= 1;
- }
- }
return ref_len == new_len && strncmp(ref_s, new_s, ref_len) == 0;
}
diff --git a/test/cctest/test-mark-compact.cc b/test/cctest/test-mark-compact.cc
index 86f105f..3e3175e 100644
--- a/test/cctest/test-mark-compact.cc
+++ b/test/cctest/test-mark-compact.cc
@@ -189,7 +189,8 @@
function->set_initial_map(initial_map);
Top::context()->global()->SetProperty(func_name,
function,
- NONE)->ToObjectChecked();
+ NONE,
+ kNonStrictMode)->ToObjectChecked();
JSObject* obj =
JSObject::cast(Heap::AllocateJSObject(function)->ToObjectChecked());
@@ -208,10 +209,14 @@
String::cast(Heap::LookupAsciiSymbol("theObject")->ToObjectChecked());
Top::context()->global()->SetProperty(obj_name,
obj,
- NONE)->ToObjectChecked();
+ NONE,
+ kNonStrictMode)->ToObjectChecked();
String* prop_name =
String::cast(Heap::LookupAsciiSymbol("theSlot")->ToObjectChecked());
- obj->SetProperty(prop_name, Smi::FromInt(23), NONE)->ToObjectChecked();
+ obj->SetProperty(prop_name,
+ Smi::FromInt(23),
+ NONE,
+ kNonStrictMode)->ToObjectChecked();
Heap::CollectGarbage(OLD_POINTER_SPACE);
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 151cf50..8ee4038 100755
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -321,14 +321,17 @@
data->Initialize();
- int first_function = strstr(program, "function") - program;
- int first_lbrace = first_function + strlen("function () ");
+ int first_function =
+ static_cast<int>(strstr(program, "function") - program);
+ int first_lbrace = first_function + static_cast<int>(strlen("function () "));
CHECK_EQ('{', program[first_lbrace]);
i::FunctionEntry entry1 = data->GetFunctionEntry(first_lbrace);
CHECK(!entry1.is_valid());
- int second_function = strstr(program + first_lbrace, "function") - program;
- int second_lbrace = second_function + strlen("function () ");
+ int second_function =
+ static_cast<int>(strstr(program + first_lbrace, "function") - program);
+ int second_lbrace =
+ second_function + static_cast<int>(strlen("function () "));
CHECK_EQ('{', program[second_lbrace]);
i::FunctionEntry entry2 = data->GetFunctionEntry(second_lbrace);
CHECK(entry2.is_valid());
diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc
index f849d40..c60d072 100644
--- a/test/cctest/test-profile-generator.cc
+++ b/test/cctest/test-profile-generator.cc
@@ -600,13 +600,13 @@
// -> ccc -> aaa - sample3
TickSample sample1;
sample1.pc = ToAddress(0x1600);
- sample1.function = ToAddress(0x1500);
+ sample1.tos = ToAddress(0x1500);
sample1.stack[0] = ToAddress(0x1510);
sample1.frames_count = 1;
generator.RecordTickSample(sample1);
TickSample sample2;
sample2.pc = ToAddress(0x1925);
- sample2.function = ToAddress(0x1900);
+ sample2.tos = ToAddress(0x1900);
sample2.stack[0] = ToAddress(0x1780);
sample2.stack[1] = ToAddress(0x10000); // non-existent.
sample2.stack[2] = ToAddress(0x1620);
@@ -614,7 +614,7 @@
generator.RecordTickSample(sample2);
TickSample sample3;
sample3.pc = ToAddress(0x1510);
- sample3.function = ToAddress(0x1500);
+ sample3.tos = ToAddress(0x1500);
sample3.stack[0] = ToAddress(0x1910);
sample3.stack[1] = ToAddress(0x1610);
sample3.frames_count = 2;
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index 1cbaf2b..80910c2 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -104,7 +104,7 @@
ExternalReferenceEncoder encoder;
CHECK_EQ(make_code(BUILTIN, Builtins::ArrayCode),
Encode(encoder, Builtins::ArrayCode));
- CHECK_EQ(make_code(RUNTIME_FUNCTION, Runtime::kAbort),
+ CHECK_EQ(make_code(v8::internal::RUNTIME_FUNCTION, Runtime::kAbort),
Encode(encoder, Runtime::kAbort));
CHECK_EQ(make_code(IC_UTILITY, IC::kLoadCallbackProperty),
Encode(encoder, IC_Utility(IC::kLoadCallbackProperty)));
@@ -142,7 +142,8 @@
CHECK_EQ(AddressOf(Builtins::ArrayCode),
decoder.Decode(make_code(BUILTIN, Builtins::ArrayCode)));
CHECK_EQ(AddressOf(Runtime::kAbort),
- decoder.Decode(make_code(RUNTIME_FUNCTION, Runtime::kAbort)));
+ decoder.Decode(make_code(v8::internal::RUNTIME_FUNCTION,
+ Runtime::kAbort)));
CHECK_EQ(AddressOf(IC_Utility(IC::kLoadCallbackProperty)),
decoder.Decode(make_code(IC_UTILITY, IC::kLoadCallbackProperty)));
ExternalReference keyed_load_function =