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

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

Issue 2223523002: [Interpreter] Avoid dereferencing handles on BytecodeGenerator for AST operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@offheap_const_array
Patch Set: Rebase Created 4 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
« no previous file with comments | « src/interpreter/bytecode-peephole-optimizer.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 23941 matching lines...) Expand 10 before | Expand all | Expand 10 after
23952 // handles so that they are only added to the constant pool array once. 23952 // handles so that they are only added to the constant pool array once.
23953 const char* chunks[] = {"var a = {};", 23953 const char* chunks[] = {"var a = {};",
23954 "var b = {};", 23954 "var b = {};",
23955 "var c = 'testing';", 23955 "var c = 'testing';",
23956 "var d = 'testing';", 23956 "var d = 'testing';",
23957 "13;", 23957 "13;",
23958 NULL}; 23958 NULL};
23959 RunStreamingTest(chunks); 23959 RunStreamingTest(chunks);
23960 } 23960 }
23961 23961
23962 TEST(StreamingScriptEvalShadowing) {
23963 // When run with Ignition, tests that the streaming parser canonicalizes
23964 // handles so the Variable::is_possibly_eval() is correct.
23965 const char* chunk1 =
23966 "(function() {\n"
23967 " var y = 2;\n"
23968 " return (function() {\n"
23969 " eval('var y = 13;');\n"
23970 " function g() {\n"
23971 " return y\n"
23972 " }\n"
23973 " return g();\n"
23974 " })()\n"
23975 "})()\n";
23976 const char* chunks[] = {chunk1, NULL};
23977 RunStreamingTest(chunks);
23978 }
23979
23962 TEST(StreamingBiggerScript) { 23980 TEST(StreamingBiggerScript) {
23963 const char* chunk1 = 23981 const char* chunk1 =
23964 "function foo() {\n" 23982 "function foo() {\n"
23965 " // Make this chunk sufficiently long so that it will overflow the\n" 23983 " // Make this chunk sufficiently long so that it will overflow the\n"
23966 " // backing buffer of the Scanner.\n" 23984 " // backing buffer of the Scanner.\n"
23967 " var i = 0;\n" 23985 " var i = 0;\n"
23968 " var result = 0;\n" 23986 " var result = 0;\n"
23969 " for (i = 0; i < 13; ++i) { result = result + 1; }\n" 23987 " for (i = 0; i < 13; ++i) { result = result + 1; }\n"
23970 " result = 0;\n" 23988 " result = 0;\n"
23971 " for (i = 0; i < 13; ++i) { result = result + 1; }\n" 23989 " for (i = 0; i < 13; ++i) { result = result + 1; }\n"
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
25506 25524
25507 // Put the function into context1 and call it. Since the access check 25525 // Put the function into context1 and call it. Since the access check
25508 // callback always returns true, the call succeeds even though the tokens 25526 // callback always returns true, the call succeeds even though the tokens
25509 // are different. 25527 // are different.
25510 context1->Enter(); 25528 context1->Enter();
25511 context1->Global()->Set(context1, v8_str("fun"), fun).FromJust(); 25529 context1->Global()->Set(context1, v8_str("fun"), fun).FromJust();
25512 v8::Local<v8::Value> x_value = CompileRun("fun('x')"); 25530 v8::Local<v8::Value> x_value = CompileRun("fun('x')");
25513 CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); 25531 CHECK_EQ(42, x_value->Int32Value(context1).FromJust());
25514 context1->Exit(); 25532 context1->Exit();
25515 } 25533 }
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-peephole-optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698