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

Side by Side Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 1308693014: [Interpreter] Ensure that implicit return undefined is generated. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add comment Created 5 years, 3 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-generator.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/interpreter/bytecode-generator.h" 8 #include "src/interpreter/bytecode-generator.h"
9 #include "src/interpreter/interpreter.h" 9 #include "src/interpreter/interpreter.h"
10 #include "test/cctest/cctest.h" 10 #include "test/cctest/cctest.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #define B(x) static_cast<uint8_t>(Bytecode::k##x) 72 #define B(x) static_cast<uint8_t>(Bytecode::k##x)
73 #define U8(x) static_cast<uint8_t>((x) & 0xff) 73 #define U8(x) static_cast<uint8_t>((x) & 0xff)
74 #define R(x) static_cast<uint8_t>(-(x) & 0xff) 74 #define R(x) static_cast<uint8_t>(-(x) & 0xff)
75 75
76 76
77 TEST(PrimitiveReturnStatements) { 77 TEST(PrimitiveReturnStatements) {
78 InitializedHandleScope handle_scope; 78 InitializedHandleScope handle_scope;
79 BytecodeGeneratorHelper helper; 79 BytecodeGeneratorHelper helper;
80 80
81 ExpectedSnippet<void*> snippets[] = { 81 ExpectedSnippet<void*> snippets[] = {
82 {"", 0, 1, 2, {B(LdaUndefined), B(Return)}, 0},
82 {"return;", 0, 1, 2, {B(LdaUndefined), B(Return)}, 0}, 83 {"return;", 0, 1, 2, {B(LdaUndefined), B(Return)}, 0},
83 {"return null;", 0, 1, 2, {B(LdaNull), B(Return)}, 0}, 84 {"return null;", 0, 1, 2, {B(LdaNull), B(Return)}, 0},
84 {"return true;", 0, 1, 2, {B(LdaTrue), B(Return)}, 0}, 85 {"return true;", 0, 1, 2, {B(LdaTrue), B(Return)}, 0},
85 {"return false;", 0, 1, 2, {B(LdaFalse), B(Return)}, 0}, 86 {"return false;", 0, 1, 2, {B(LdaFalse), B(Return)}, 0},
86 {"return 0;", 0, 1, 2, {B(LdaZero), B(Return)}, 0}, 87 {"return 0;", 0, 1, 2, {B(LdaZero), B(Return)}, 0},
87 {"return +1;", 0, 1, 3, {B(LdaSmi8), U8(1), B(Return)}, 0}, 88 {"return +1;", 0, 1, 3, {B(LdaSmi8), U8(1), B(Return)}, 0},
88 {"return -1;", 0, 1, 3, {B(LdaSmi8), U8(-1), B(Return)}, 0}, 89 {"return -1;", 0, 1, 3, {B(LdaSmi8), U8(-1), B(Return)}, 0},
89 {"return +127;", 0, 1, 3, {B(LdaSmi8), U8(127), B(Return)}, 0}, 90 {"return +127;", 0, 1, 3, {B(LdaSmi8), U8(127), B(Return)}, 0},
90 {"return -128;", 0, 1, 3, {B(LdaSmi8), U8(-128), B(Return)}, 0}, 91 {"return -128;", 0, 1, 3, {B(LdaSmi8), U8(-128), B(Return)}, 0},
91 }; 92 };
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 Handle<String> expected = helper.factory()->NewStringFromAsciiChecked( 415 Handle<String> expected = helper.factory()->NewStringFromAsciiChecked(
415 snippets[i].constants[j]); 416 snippets[i].constants[j]);
416 CHECK(String::cast(ba->constant_pool()->get(j))->Equals(*expected)); 417 CHECK(String::cast(ba->constant_pool()->get(j))->Equals(*expected));
417 } 418 }
418 } 419 }
419 } 420 }
420 421
421 } // namespace interpreter 422 } // namespace interpreter
422 } // namespace internal 423 } // namespace internal
423 } // namespance v8 424 } // namespance v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698