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 8010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8021 "function f1() {" | 8021 "function f1() {" |
8022 " var y;" | 8022 " var y;" |
8023 " eval(\"function t() {"; | 8023 " eval(\"function t() {"; |
8024 const char* function_epilogue = " }; f = t; f();\");" | 8024 const char* function_epilogue = " }; f = t; f();\");" |
8025 "}" | 8025 "}" |
8026 "f1();"; | 8026 "f1();"; |
8027 | 8027 |
8028 // clang-format off | 8028 // clang-format off |
8029 ExpectedSnippet<const char*> snippets[] = { | 8029 ExpectedSnippet<const char*> snippets[] = { |
8030 {"delete x;", | 8030 {"delete x;", |
8031 0 * kPointerSize, | 8031 1 * kPointerSize, |
8032 1, | 8032 1, |
8033 6, | 8033 12, |
8034 { | 8034 { |
8035 B(StackCheck), // | 8035 B(StackCheck), // |
8036 B(LdaConstant), U8(0), // | 8036 B(LdaConstant), U8(0), // |
8037 B(DeleteLookupSlot), // | 8037 B(Star), R(0), // |
8038 B(LdaUndefined), // | 8038 B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), // |
8039 B(Return) // | 8039 B(LdaUndefined), // |
| 8040 B(Return) // |
8040 }, | 8041 }, |
8041 1, | 8042 1, |
8042 {"x"}}, | 8043 {"x"}}, |
8043 {"return delete y;", | 8044 {"return delete y;", |
8044 0 * kPointerSize, | 8045 0 * kPointerSize, |
8045 1, | 8046 1, |
8046 3, | 8047 3, |
8047 { | 8048 { |
8048 B(StackCheck), // | 8049 B(StackCheck), // |
8049 B(LdaFalse), // | 8050 B(LdaFalse), // |
8050 B(Return) // | 8051 B(Return) // |
8051 }, | 8052 }, |
8052 0}, | 8053 0}, |
8053 {"return delete z;", | 8054 {"return delete z;", |
8054 0 * kPointerSize, | 8055 1 * kPointerSize, |
8055 1, | 8056 1, |
8056 5, | 8057 11, |
8057 { | 8058 { |
8058 B(StackCheck), // | 8059 B(StackCheck), // |
8059 B(LdaConstant), U8(0), // | 8060 B(LdaConstant), U8(0), // |
8060 B(DeleteLookupSlot), // | 8061 B(Star), R(0), // |
8061 B(Return) // | 8062 B(CallRuntime), U16(Runtime::kDeleteLookupSlot), R(0), U8(1), // |
| 8063 B(Return) // |
8062 }, | 8064 }, |
8063 1, | 8065 1, |
8064 {"z"}}, | 8066 {"z"}}, |
8065 }; | 8067 }; |
8066 // clang-format on | 8068 // clang-format on |
8067 | 8069 |
8068 for (size_t i = 0; i < arraysize(snippets); i++) { | 8070 for (size_t i = 0; i < arraysize(snippets); i++) { |
8069 std::string script = std::string(function_prologue) + | 8071 std::string script = std::string(function_prologue) + |
8070 std::string(snippets[i].code_snippet) + | 8072 std::string(snippets[i].code_snippet) + |
8071 std::string(function_epilogue); | 8073 std::string(function_epilogue); |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9226 for (size_t i = 0; i < arraysize(snippets); i++) { | 9228 for (size_t i = 0; i < arraysize(snippets); i++) { |
9227 Handle<BytecodeArray> bytecode_array = | 9229 Handle<BytecodeArray> bytecode_array = |
9228 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 9230 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
9229 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 9231 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
9230 } | 9232 } |
9231 } | 9233 } |
9232 | 9234 |
9233 } // namespace interpreter | 9235 } // namespace interpreter |
9234 } // namespace internal | 9236 } // namespace internal |
9235 } // namespace v8 | 9237 } // namespace v8 |
OLD | NEW |