Fix issue with context not being saved on x64 introduced in 144543004
authordcarney@chromium.org <dcarney@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 27 Jan 2014 08:12:59 +0000 (08:12 +0000)
committerdcarney@chromium.org <dcarney@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 27 Jan 2014 08:12:59 +0000 (08:12 +0000)
TBR=verwaest@chromium.org

BUG=

Review URL: https://codereview.chromium.org/143333003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18845 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/x64/stub-cache-x64.cc
test/cctest/test-accessors.cc

index dbfd419..b579e94 100644 (file)
@@ -521,6 +521,7 @@ static void GenerateFastApiCallBody(MacroAssembler* masm,
   Handle<JSFunction> function = optimization.constant_function();
   __ Move(scratch2, function);
   __ push(scratch2);
+  __ movp(rsi, FieldOperand(scratch2, JSFunction::kContextOffset));
 
   Isolate* isolate = masm->isolate();
   Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
index cbbdc50..a3ce5c3 100644 (file)
@@ -580,14 +580,27 @@ THREADED_TEST(JSONStringifyNamedInterceptorObject) {
 }
 
 
+static v8::Local<v8::Context> expected_current_context;
+static v8::Local<v8::Context> expected_calling_context;
+
+
+static void check_contexts(const v8::FunctionCallbackInfo<v8::Value>& info) {
+  ApiTestFuzzer::Fuzz();
+  CHECK(expected_current_context == info.GetIsolate()->GetCurrentContext());
+  CHECK(expected_calling_context == info.GetIsolate()->GetCallingContext());
+}
+
+
 THREADED_TEST(AccessorPropertyCrossContext) {
   LocalContext env;
   v8::Isolate* isolate = env->GetIsolate();
   v8::HandleScope scope(isolate);
-  v8::Handle<v8::Function> fun = v8::Function::New(isolate, handle_property);
+  v8::Handle<v8::Function> fun = v8::Function::New(isolate, check_contexts);
   LocalContext switch_context;
   switch_context->Global()->Set(v8_str("fun"), fun);
   v8::TryCatch try_catch;
+  expected_current_context = env.local();
+  expected_calling_context = switch_context.local();
   CompileRun(
       "var o = Object.create(null, { n: { get:fun } });"
       "for (var i = 0; i < 10; i++) o.n;");