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

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

Issue 1612373004: [interpreter] Fix bogus test expecation for bytecode generator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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-array-iterator.h" 8 #include "src/interpreter/bytecode-array-iterator.h"
9 #include "src/interpreter/bytecode-generator.h" 9 #include "src/interpreter/bytecode-generator.h"
10 #include "src/interpreter/interpreter.h" 10 #include "src/interpreter/interpreter.h"
(...skipping 4256 matching lines...) Expand 10 before | Expand all | Expand 10 after
4267 InitializedHandleScope handle_scope; 4267 InitializedHandleScope handle_scope;
4268 BytecodeGeneratorHelper helper; 4268 BytecodeGeneratorHelper helper;
4269 4269
4270 int closure = Register::function_closure().index(); 4270 int closure = Register::function_closure().index();
4271 int context = Register::function_context().index(); 4271 int context = Register::function_context().index();
4272 4272
4273 ExpectedSnippet<const char*> snippets[] = { 4273 ExpectedSnippet<const char*> snippets[] = {
4274 {"try { return 1; } catch(e) { return 2; }", 4274 {"try { return 1; } catch(e) { return 2; }",
4275 5 * kPointerSize, 4275 5 * kPointerSize,
4276 1, 4276 1,
4277 25, 4277 27,
4278 { 4278 {
4279 B(LdaSmi8), U8(1), // 4279 B(LdaSmi8), U8(1), //
4280 B(Return), // 4280 B(Return), //
4281 B(Star), R(3), // 4281 B(Star), R(3), //
4282 B(LdaConstant), U8(0), // 4282 B(LdaConstant), U8(0), //
4283 B(Star), R(2), // 4283 B(Star), R(2), //
4284 B(Ldar), R(closure), // 4284 B(Ldar), R(closure), //
4285 B(Star), R(4), // 4285 B(Star), R(4), //
4286 B(CallRuntime), U16(Runtime::kPushCatchContext), R(2), U8(3), // 4286 B(CallRuntime), U16(Runtime::kPushCatchContext), R(2), U8(3), //
4287 B(PushContext), R(0), // 4287 B(PushContext), R(0), //
4288 B(LdaSmi8), U8(2), // 4288 B(LdaSmi8), U8(2), //
4289 B(PopContext), R(context), //
4289 B(Return), // 4290 B(Return), //
4290 // TODO(mstarzinger): Potential optimization, elide next bytes. 4291 // TODO(mstarzinger): Potential optimization, elide next bytes.
4291 B(LdaUndefined), // 4292 B(LdaUndefined), //
4292 B(Return), // 4293 B(Return), //
4293 }, 4294 },
4294 1, 4295 1,
4295 {"e"}, 4296 {"e"},
4296 1, 4297 1,
4297 {{0, 3, 3}}}, 4298 {{0, 3, 3}}},
4298 {"var a; try { a = 1 } catch(e1) {}; try { a = 2 } catch(e2) { a = 3 }", 4299 {"var a; try { a = 1 } catch(e1) {}; try { a = 2 } catch(e2) { a = 3 }",
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
4615 BytecodeGeneratorHelper helper; 4616 BytecodeGeneratorHelper helper;
4616 Zone zone; 4617 Zone zone;
4617 4618
4618 FeedbackVectorSpec feedback_spec(&zone); 4619 FeedbackVectorSpec feedback_spec(&zone);
4619 FeedbackVectorSlot slot = feedback_spec.AddCallICSlot(); 4620 FeedbackVectorSlot slot = feedback_spec.AddCallICSlot();
4620 4621
4621 Handle<i::TypeFeedbackVector> vector = 4622 Handle<i::TypeFeedbackVector> vector =
4622 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); 4623 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
4623 4624
4624 int closure = Register::function_closure().index(); 4625 int closure = Register::function_closure().index();
4626 int context = Register::function_context().index();
4625 int new_target = Register::new_target().index(); 4627 int new_target = Register::new_target().index();
4626 int first_context_slot = Context::MIN_CONTEXT_SLOTS; 4628 int first_context_slot = Context::MIN_CONTEXT_SLOTS;
4627 4629
4628 // The wide check below relies on MIN_CONTEXT_SLOTS + 3 + 249 == 256, if this 4630 // The wide check below relies on MIN_CONTEXT_SLOTS + 3 + 249 == 256, if this
4629 // ever changes, the REPEAT_XXX should be changed to output the correct number 4631 // ever changes, the REPEAT_XXX should be changed to output the correct number
4630 // of unique variables to trigger the wide slot load / store. 4632 // of unique variables to trigger the wide slot load / store.
4631 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS + 3 + 249 == 256); 4633 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS + 3 + 249 == 256);
4632 int wide_slot = first_context_slot + 3; 4634 int wide_slot = first_context_slot + 3;
4633 4635
4634 ExpectedSnippet<InstanceType> snippets[] = { 4636 ExpectedSnippet<InstanceType> snippets[] = {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
4691 B(Star), R(1), // 4693 B(Star), R(1), //
4692 B(Call), R(1), R(2), U8(0), U8(vector->GetIndex(slot)), // 4694 B(Call), R(1), R(2), U8(0), U8(vector->GetIndex(slot)), //
4693 B(LdaContextSlot), R(0), U8(first_context_slot), // 4695 B(LdaContextSlot), R(0), U8(first_context_slot), //
4694 B(Return), // 4696 B(Return), //
4695 }, 4697 },
4696 1, 4698 1,
4697 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, 4699 {InstanceType::SHARED_FUNCTION_INFO_TYPE}},
4698 {"'use strict'; let a = 1; { let b = 2; return function() { a + b; }; }", 4700 {"'use strict'; let a = 1; { let b = 2; return function() { a + b; }; }",
4699 4 * kPointerSize, 4701 4 * kPointerSize,
4700 1, 4702 1,
4701 44, 4703 46,
4702 { 4704 {
4703 B(CallRuntime), U16(Runtime::kNewFunctionContext), // 4705 B(CallRuntime), U16(Runtime::kNewFunctionContext), //
4704 R(closure), U8(1), // 4706 R(closure), U8(1), //
4705 B(PushContext), R(0), // 4707 B(PushContext), R(0), //
4706 B(LdaTheHole), // 4708 B(LdaTheHole), //
4707 B(StaContextSlot), R(0), U8(first_context_slot), // 4709 B(StaContextSlot), R(0), U8(first_context_slot), //
4708 B(LdaSmi8), U8(1), // 4710 B(LdaSmi8), U8(1), //
4709 B(StaContextSlot), R(0), U8(first_context_slot), // 4711 B(StaContextSlot), R(0), U8(first_context_slot), //
4710 B(LdaConstant), U8(0), // 4712 B(LdaConstant), U8(0), //
4711 B(Star), R(2), // 4713 B(Star), R(2), //
4712 B(Ldar), R(closure), // 4714 B(Ldar), R(closure), //
4713 B(Star), R(3), // 4715 B(Star), R(3), //
4714 B(CallRuntime), U16(Runtime::kPushBlockContext), R(2), U8(2), // 4716 B(CallRuntime), U16(Runtime::kPushBlockContext), R(2), U8(2), //
4715 B(PushContext), R(1), // 4717 B(PushContext), R(1), //
4716 B(LdaTheHole), // 4718 B(LdaTheHole), //
4717 B(StaContextSlot), R(1), U8(first_context_slot), // 4719 B(StaContextSlot), R(1), U8(first_context_slot), //
4718 B(LdaSmi8), U8(2), // 4720 B(LdaSmi8), U8(2), //
4719 B(StaContextSlot), R(1), U8(first_context_slot), // 4721 B(StaContextSlot), R(1), U8(first_context_slot), //
4720 B(CreateClosure), U8(1), U8(0), // 4722 B(CreateClosure), U8(1), U8(0), //
4723 B(PopContext), R(context), //
4721 B(Return), // 4724 B(Return), //
4722 }, 4725 },
4723 2, 4726 2,
4724 {InstanceType::FIXED_ARRAY_TYPE, 4727 {InstanceType::FIXED_ARRAY_TYPE,
4725 InstanceType::SHARED_FUNCTION_INFO_TYPE}}, 4728 InstanceType::SHARED_FUNCTION_INFO_TYPE}},
4726 {"'use strict';\n" 4729 {"'use strict';\n"
4727 REPEAT_249_UNIQUE_VARS() 4730 REPEAT_249_UNIQUE_VARS()
4728 "eval();" 4731 "eval();"
4729 "var b = 100;" 4732 "var b = 100;"
4730 "return b", 4733 "return b",
(...skipping 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after
7033 std::string(function_epilogue); 7036 std::string(function_epilogue);
7034 Handle<BytecodeArray> bytecode_array = 7037 Handle<BytecodeArray> bytecode_array =
7035 helper.MakeBytecode(script.c_str(), "*", "f"); 7038 helper.MakeBytecode(script.c_str(), "*", "f");
7036 CheckBytecodeArrayEqual(snippets[i], bytecode_array); 7039 CheckBytecodeArrayEqual(snippets[i], bytecode_array);
7037 } 7040 }
7038 } 7041 }
7039 7042
7040 } // namespace interpreter 7043 } // namespace interpreter
7041 } // namespace internal 7044 } // namespace internal
7042 } // namespace v8 7045 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698