Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: test/cctest/compiler/test-run-jscalls.cc

Issue 489543002: Revert "Load global object and builtins from activation." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "test/cctest/compiler/function-tester.h" 7 #include "test/cctest/compiler/function-tester.h"
8 8
9 using namespace v8::internal; 9 using namespace v8::internal;
10 using namespace v8::internal::compiler; 10 using namespace v8::internal::compiler;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 TEST(CallEval) { 238 TEST(CallEval) {
239 FunctionTester T( 239 FunctionTester T(
240 "var x = 42;" 240 "var x = 42;"
241 "(function () {" 241 "(function () {"
242 "function bar() { return eval('x') };" 242 "function bar() { return eval('x') };"
243 "return bar;" 243 "return bar;"
244 "})();"); 244 "})();");
245 245
246 T.CheckCall(T.Val(42), T.Val("x"), T.undefined()); 246 T.CheckCall(T.Val(42), T.Val("x"), T.undefined());
247 } 247 }
248
249 #if V8_TURBOFAN_TARGET
250
251 TEST(ContextLoadedFromActivation) {
252 i::FLAG_turbo_filter = "*";
253 i::FLAG_always_opt = true;
254 i::FLAG_context_specialization = false;
255
256 const char* script =
257 "var x = 42;"
258 "(function() {"
259 " return function () { return x };"
260 "})()";
261
262 v8::Isolate* isolate = CcTest::isolate();
263 v8::HandleScope outer(isolate);
264 v8::Local<v8::Value> fun;
265 {
266 v8::Local<v8::Context> env = v8::Context::New(isolate);
267 env->Enter();
268 CompileRun("var x = 42;");
269 fun = CompileRun(script);
270 env->Global()->Set(v8_str("foo"), fun);
271 ExpectInt32("foo();", 42);
272 env->Exit();
273 }
274
275 {
276 v8::Local<v8::Context> env = v8::Context::New(isolate);
277 env->Enter();
278 v8::Local<v8::Value> fun2 = CompileRun(script);
279 i::Handle<i::Object> oifun = v8::Utils::OpenHandle(*fun);
280 i::Handle<i::JSFunction> ifun = Handle<JSFunction>::cast(oifun);
281 i::Handle<i::Object> oifun2 = v8::Utils::OpenHandle(*fun2);
282 i::Handle<i::JSFunction> ifun2 = Handle<JSFunction>::cast(oifun2);
283 ifun2->set_code(ifun->code());
284 env->Global()->Set(v8_str("foo"), fun2);
285 CompileRun("var x = 24;");
286 ExpectInt32("foo();", 24);
287 env->Exit();
288 }
289 }
290
291
292 TEST(BuiltinLoadedFromActivation) {
293 i::FLAG_turbo_filter = "*";
294 i::FLAG_always_opt = true;
295 i::FLAG_context_specialization = false;
296
297 const char* script =
298 "var x = 42;"
299 "(function() {"
300 " return function () { return this; };"
301 "})()";
302
303 v8::Isolate* isolate = CcTest::isolate();
304 v8::HandleScope outer(isolate);
305 v8::Local<v8::Value> fun;
306 {
307 v8::Local<v8::Context> env = v8::Context::New(isolate);
308 env->Enter();
309 CompileRun("var x = 42;");
310 fun = CompileRun(script);
311 env->Global()->Set(v8_str("foo"), fun);
312 ExpectObject("foo()", env->Global());
313 env->Exit();
314 }
315
316 {
317 v8::Local<v8::Context> env = v8::Context::New(isolate);
318 env->Enter();
319 v8::Local<v8::Value> fun2 = CompileRun(script);
320 i::Handle<i::Object> oifun = v8::Utils::OpenHandle(*fun);
321 i::Handle<i::JSFunction> ifun = Handle<JSFunction>::cast(oifun);
322 i::Handle<i::Object> oifun2 = v8::Utils::OpenHandle(*fun2);
323 i::Handle<i::JSFunction> ifun2 = Handle<JSFunction>::cast(oifun2);
324 ifun2->set_code(ifun->code());
325 env->Global()->Set(v8_str("foo"), fun2);
326 CompileRun("var x = 24;");
327 ExpectObject("foo()", env->Global());
328 env->Exit();
329 }
330 }
331
332 #endif // V8_TURBO_TARGET
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698