update V8 to r5532 as required by WebKit r68651
Change-Id: I5f75eeffbf64b30dd5080348528d277f293490ad
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 2b50db7..1b6359b 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -2937,6 +2937,49 @@
}
+THREADED_TEST(NamedInterceptorDictionaryICMultipleContext) {
+ v8::HandleScope scope;
+
+ v8::Persistent<Context> context1 = Context::New();
+
+ context1->Enter();
+ Local<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->SetNamedPropertyHandler(XPropertyGetter);
+ // Create an object with a named interceptor.
+ v8::Local<v8::Object> object = templ->NewInstance();
+ context1->Global()->Set(v8_str("interceptor_obj"), object);
+
+ // Force the object into the slow case.
+ CompileRun("interceptor_obj.y = 0;"
+ "delete interceptor_obj.y;");
+ context1->Exit();
+
+ {
+ // Introduce the object into a different context.
+ // Repeat named loads to exercise ICs.
+ LocalContext context2;
+ context2->Global()->Set(v8_str("interceptor_obj"), object);
+ Local<Value> result =
+ CompileRun("function get_x(o) { return o.x; }"
+ "interceptor_obj.x = 42;"
+ "for (var i=0; i != 10; i++) {"
+ " get_x(interceptor_obj);"
+ "}"
+ "get_x(interceptor_obj)");
+ // Check that the interceptor was actually invoked.
+ CHECK_EQ(result, v8_str("x"));
+ }
+
+ // Return to the original context and force some object to the slow case
+ // to cause the NormalizedMapCache to verify.
+ context1->Enter();
+ CompileRun("var obj = { x : 0 }; delete obj.x;");
+ context1->Exit();
+
+ context1.Dispose();
+}
+
+
static v8::Handle<Value> SetXOnPrototypeGetter(Local<String> property,
const AccessorInfo& info) {
// Set x on the prototype object and do not handle the get request.
@@ -3022,6 +3065,27 @@
}
+THREADED_TEST(IndexedInterceptorWithGetOwnPropertyDescriptor) {
+ v8::HandleScope scope;
+ Local<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->SetIndexedPropertyHandler(IdentityIndexedPropertyGetter);
+
+ LocalContext context;
+ context->Global()->Set(v8_str("obj"), templ->NewInstance());
+
+ // Check fast object case.
+ const char* fast_case_code =
+ "Object.getOwnPropertyDescriptor(obj, 0).value.toString()";
+ ExpectString(fast_case_code, "0");
+
+ // Check slow case.
+ const char* slow_case_code =
+ "obj.x = 1; delete obj.x;"
+ "Object.getOwnPropertyDescriptor(obj, 1).value.toString()";
+ ExpectString(slow_case_code, "1");
+}
+
+
THREADED_TEST(IndexedInterceptorWithNoSetter) {
v8::HandleScope scope;
Local<ObjectTemplate> templ = ObjectTemplate::New();
@@ -10947,7 +11011,9 @@
CompileRun(source);
script = v8::Script::Compile(v8_str("new C1();"));
- for (int i = 0; i < 10; i++) {
+ // Allow enough iterations for the inobject slack tracking logic
+ // to finalize instance size and install the fast construct stub.
+ for (int i = 0; i < 256; i++) {
v8::Handle<v8::Object> c1 = v8::Handle<v8::Object>::Cast(script->Run());
CHECK_EQ(23, c1->Get(v8_str("x"))->Int32Value());
CHECK_EQ(42, c1->Get(v8_str("y"))->Int32Value());
@@ -11308,3 +11374,72 @@
// the other tests.
v8::V8::SetFailedAccessCheckCallbackFunction(NULL);
}
+
+
+TEST(StringCheckMultipleContexts) {
+ const char* code =
+ "(function() { return \"a\".charAt(0); })()";
+
+ {
+ // Run the code twice in the first context to initialize the call IC.
+ v8::HandleScope scope;
+ LocalContext context1;
+ ExpectString(code, "a");
+ ExpectString(code, "a");
+ }
+
+ {
+ // Change the String.prototype in the second context and check
+ // that the right function gets called.
+ v8::HandleScope scope;
+ LocalContext context2;
+ CompileRun("String.prototype.charAt = function() { return \"not a\"; }");
+ ExpectString(code, "not a");
+ }
+}
+
+
+TEST(NumberCheckMultipleContexts) {
+ const char* code =
+ "(function() { return (42).toString(); })()";
+
+ {
+ // Run the code twice in the first context to initialize the call IC.
+ v8::HandleScope scope;
+ LocalContext context1;
+ ExpectString(code, "42");
+ ExpectString(code, "42");
+ }
+
+ {
+ // Change the Number.prototype in the second context and check
+ // that the right function gets called.
+ v8::HandleScope scope;
+ LocalContext context2;
+ CompileRun("Number.prototype.toString = function() { return \"not 42\"; }");
+ ExpectString(code, "not 42");
+ }
+}
+
+
+TEST(BooleanCheckMultipleContexts) {
+ const char* code =
+ "(function() { return true.toString(); })()";
+
+ {
+ // Run the code twice in the first context to initialize the call IC.
+ v8::HandleScope scope;
+ LocalContext context1;
+ ExpectString(code, "true");
+ ExpectString(code, "true");
+ }
+
+ {
+ // Change the Boolean.prototype in the second context and check
+ // that the right function gets called.
+ v8::HandleScope scope;
+ LocalContext context2;
+ CompileRun("Boolean.prototype.toString = function() { return \"\"; }");
+ ExpectString(code, "");
+ }
+}