| OLD | NEW |
| 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 "src/interpreter/bytecode-array-builder.h" | 7 #include "src/interpreter/bytecode-array-builder.h" |
| 8 #include "test/cctest/cctest.h" | 8 #include "test/cctest/cctest.h" |
| 9 | 9 |
| 10 using namespace v8::internal; | 10 using namespace v8::internal; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 #define CHECK_BYTECODE_PRESENT(Name, ...) \ | 61 #define CHECK_BYTECODE_PRESENT(Name, ...) \ |
| 62 /* Check Bytecode is marked in scorecard */ \ | 62 /* Check Bytecode is marked in scorecard */ \ |
| 63 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); | 63 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); |
| 64 BYTECODE_LIST(CHECK_BYTECODE_PRESENT) | 64 BYTECODE_LIST(CHECK_BYTECODE_PRESENT) |
| 65 #undef CHECK_BYTECODE_PRESENT | 65 #undef CHECK_BYTECODE_PRESENT |
| 66 } | 66 } |
| 67 | 67 |
| 68 | 68 |
| 69 TEST(FrameSizesLookGood) { | 69 TEST(FrameSizesLookGood) { |
| 70 for (int locals = 1; locals < 5; locals++) { | 70 for (int locals = 0; locals < 5; locals++) { |
| 71 for (int temps = 0; temps < 3; temps++) { | 71 for (int temps = 0; temps < 3; temps++) { |
| 72 InitializedHandleScope handle_scope; | 72 InitializedHandleScope handle_scope; |
| 73 BytecodeArrayBuilder builder(handle_scope.main_isolate()); | 73 BytecodeArrayBuilder builder(handle_scope.main_isolate()); |
| 74 builder.set_locals_count(locals); | 74 builder.set_locals_count(locals); |
| 75 builder.Return(); | 75 builder.Return(); |
| 76 | 76 |
| 77 TemporaryRegisterScope temporaries(&builder); | 77 TemporaryRegisterScope temporaries(&builder); |
| 78 for (int i = 0; i < temps; i++) { | 78 for (int i = 0; i < temps; i++) { |
| 79 temporaries.NewRegister(); | 79 temporaries.NewRegister(); |
| 80 } | 80 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 int second; | 105 int second; |
| 106 { | 106 { |
| 107 TemporaryRegisterScope temporaries(&builder); | 107 TemporaryRegisterScope temporaries(&builder); |
| 108 second = temporaries.NewRegister(); | 108 second = temporaries.NewRegister(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 CHECK_EQ(first, second); | 111 CHECK_EQ(first, second); |
| 112 } | 112 } |
| OLD | NEW |