OLD | NEW |
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 SNPrintF(program, "%s\n%s();", function, kFunctionName); | 74 SNPrintF(program, "%s\n%s();", function, kFunctionName); |
75 Handle<BytecodeArray> return_val = | 75 Handle<BytecodeArray> return_val = |
76 MakeBytecode(program.start(), kFunctionName); | 76 MakeBytecode(program.start(), kFunctionName); |
77 i::FLAG_ignition_filter = old_ignition_filter; | 77 i::FLAG_ignition_filter = old_ignition_filter; |
78 return return_val; | 78 return return_val; |
79 } | 79 } |
80 }; | 80 }; |
81 | 81 |
82 | 82 |
83 // Helper macros for handcrafting bytecode sequences. | 83 // Helper macros for handcrafting bytecode sequences. |
| 84 int u16_temp; |
| 85 |
84 #define B(x) static_cast<uint8_t>(Bytecode::k##x) | 86 #define B(x) static_cast<uint8_t>(Bytecode::k##x) |
85 #define U8(x) static_cast<uint8_t>((x) & 0xff) | 87 #define U8(x) static_cast<uint8_t>((x) & 0xff) |
86 #define R(x) static_cast<uint8_t>(-(x) & 0xff) | 88 #define R(x) static_cast<uint8_t>(-(x) & 0xff) |
87 #define A(x, n) R(helper.kLastParamIndex - (n) + 1 + (x)) | 89 #define A(x, n) R(helper.kLastParamIndex - (n) + 1 + (x)) |
88 #define THIS(n) A(0, n) | 90 #define THIS(n) A(0, n) |
89 #if defined(V8_TARGET_LITTLE_ENDIAN) | 91 #if defined(V8_TARGET_LITTLE_ENDIAN) |
90 #define U16(x) static_cast<uint8_t>((x) & 0xff), \ | 92 #define U16(x) \ |
91 static_cast<uint8_t>(((x) >> kBitsPerByte) & 0xff) | 93 static_cast<uint8_t>((u16_temp = (x)) & 0xff), \ |
| 94 static_cast<uint8_t>(((u16_temp) >> kBitsPerByte) & 0xff) |
92 #elif defined(V8_TARGET_BIG_ENDIAN) | 95 #elif defined(V8_TARGET_BIG_ENDIAN) |
93 #define U16(x) static_cast<uint8_t>(((x) >> kBitsPerByte) & 0xff), \ | 96 #define U16(x) \ |
94 static_cast<uint8_t>((x) & 0xff) | 97 static_cast<uint8_t>(((u16_temp = (x)) >> kBitsPerByte) & 0xff), \ |
| 98 static_cast<uint8_t>((u16_temp)&0xff) |
95 #else | 99 #else |
96 #error Unknown byte ordering | 100 #error Unknown byte ordering |
97 #endif | 101 #endif |
98 | 102 |
99 #define COMMA() , | 103 #define COMMA() , |
100 #define SPACE() | 104 #define SPACE() |
101 | 105 |
102 #define REPEAT_2(SEP, ...) \ | 106 #define REPEAT_2(SEP, ...) \ |
103 __VA_ARGS__ SEP() __VA_ARGS__ | 107 __VA_ARGS__ SEP() __VA_ARGS__ |
104 #define REPEAT_4(SEP, ...) \ | 108 #define REPEAT_4(SEP, ...) \ |
(...skipping 4232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4337 for (size_t i = 0; i < arraysize(snippets); i++) { | 4341 for (size_t i = 0; i < arraysize(snippets); i++) { |
4338 Handle<BytecodeArray> bytecode_array = | 4342 Handle<BytecodeArray> bytecode_array = |
4339 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 4343 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
4340 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 4344 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
4341 } | 4345 } |
4342 } | 4346 } |
4343 | 4347 |
4344 } // namespace interpreter | 4348 } // namespace interpreter |
4345 } // namespace internal | 4349 } // namespace internal |
4346 } // namespace v8 | 4350 } // namespace v8 |
OLD | NEW |