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

Side by Side Diff: test/cctest/test-api.cc

Issue 8343054: Make eval consider anything on the form eval(args...) a potential direct cal (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments. Created 9 years, 1 month 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/x64/full-codegen-x64.cc ('k') | test/mjsunit/eval.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 7769 matching lines...) Expand 10 before | Expand all | Expand 10 after
7780 CHECK_EQ(2, current->Global()->Get(v8_str("result1"))->Int32Value()); 7780 CHECK_EQ(2, current->Global()->Get(v8_str("result1"))->Int32Value());
7781 CHECK_EQ(0, current->Global()->Get(v8_str("result2"))->Int32Value()); 7781 CHECK_EQ(0, current->Global()->Get(v8_str("result2"))->Int32Value());
7782 CHECK_EQ(1, current->Global()->Get(v8_str("result3"))->Int32Value()); 7782 CHECK_EQ(1, current->Global()->Get(v8_str("result3"))->Int32Value());
7783 7783
7784 v8::TryCatch try_catch; 7784 v8::TryCatch try_catch;
7785 script = 7785 script =
7786 Script::Compile(v8_str("function f(x) { " 7786 Script::Compile(v8_str("function f(x) { "
7787 " var bar = 2;" 7787 " var bar = 2;"
7788 " with (x) { return eval('bar'); }" 7788 " with (x) { return eval('bar'); }"
7789 "}" 7789 "}"
7790 "f(this)")); 7790 "result4 = f(this)"));
7791 script->Run(); 7791 script->Run();
7792 CHECK(try_catch.HasCaught()); 7792 CHECK(!try_catch.HasCaught());
7793 CHECK_EQ(2, current->Global()->Get(v8_str("result4"))->Int32Value());
7794
7793 try_catch.Reset(); 7795 try_catch.Reset();
7794 } 7796 }
7795 7797
7796 7798
7797 THREADED_TEST(CrossEval) { 7799 THREADED_TEST(CrossEval) {
7798 v8::HandleScope scope; 7800 v8::HandleScope scope;
7799 LocalContext other; 7801 LocalContext other;
7800 LocalContext current; 7802 LocalContext current;
7801 7803
7802 Local<String> token = v8_str("<security token>"); 7804 Local<String> token = v8_str("<security token>");
(...skipping 7684 matching lines...) Expand 10 before | Expand all | Expand 10 after
15487 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]"))); 15489 CHECK(i->Equals(CompileRun("'abcbd'.replace(/b/g,func)[3]")));
15488 15490
15489 // TODO(1547): Make the following also return "i". 15491 // TODO(1547): Make the following also return "i".
15490 // Calling with environment record as base. 15492 // Calling with environment record as base.
15491 TestReceiver(o, context->Global(), "func()"); 15493 TestReceiver(o, context->Global(), "func()");
15492 // Calling with no base. 15494 // Calling with no base.
15493 TestReceiver(o, context->Global(), "(1,func)()"); 15495 TestReceiver(o, context->Global(), "(1,func)()");
15494 15496
15495 foreign_context.Dispose(); 15497 foreign_context.Dispose();
15496 } 15498 }
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/mjsunit/eval.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698