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 8374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8385 }; | 8385 }; |
8386 // clang-format on | 8386 // clang-format on |
8387 | 8387 |
8388 Handle<BytecodeArray> bytecode_array = | 8388 Handle<BytecodeArray> bytecode_array = |
8389 helper.MakeBytecodeForFunctionBody(snippet.code_snippet); | 8389 helper.MakeBytecodeForFunctionBody(snippet.code_snippet); |
8390 CheckBytecodeArrayEqual(snippet, bytecode_array); | 8390 CheckBytecodeArrayEqual(snippet, bytecode_array); |
8391 } | 8391 } |
8392 | 8392 |
8393 // TODO(rmcilroy): Update expectations after switch to | 8393 // TODO(rmcilroy): Update expectations after switch to |
8394 // Runtime::kDefineDataPropertyInLiteral. | 8394 // Runtime::kDefineDataPropertyInLiteral. |
8395 DISABLED_TEST(ClassDeclarations) { | 8395 DISABLED_TEST(ClassDeclarations) { |
rmcilroy
2016/02/08 15:05:21
Ahh this is still disabled? Orion were you going t
| |
8396 InitializedHandleScope handle_scope; | 8396 InitializedHandleScope handle_scope; |
8397 BytecodeGeneratorHelper helper; | 8397 BytecodeGeneratorHelper helper; |
8398 | 8398 |
8399 int closure = Register::function_closure().index(); | 8399 int closure = Register::function_closure().index(); |
8400 int context = Register::current_context().index(); | 8400 int context = Register::current_context().index(); |
8401 | 8401 |
8402 // clang-format off | 8402 // clang-format off |
8403 ExpectedSnippet<InstanceType, 12> snippets[] = { | 8403 ExpectedSnippet<InstanceType, 12> snippets[] = { |
8404 {"class Person {\n" | 8404 {"class Person {\n" |
8405 " constructor(name) { this.name = name; }\n" | 8405 " constructor(name) { this.name = name; }\n" |
(...skipping 11 matching lines...) Expand all Loading... | |
8417 B(LdaTheHole), // | 8417 B(LdaTheHole), // |
8418 B(Star), R(2), // | 8418 B(Star), R(2), // |
8419 B(CreateClosure), U8(0), U8(0), // | 8419 B(CreateClosure), U8(0), U8(0), // |
8420 B(Star), R(3), // | 8420 B(Star), R(3), // |
8421 B(LdaSmi8), U8(15), // | 8421 B(LdaSmi8), U8(15), // |
8422 B(Star), R(4), // | 8422 B(Star), R(4), // |
8423 B(LdaConstant), U8(1), // | 8423 B(LdaConstant), U8(1), // |
8424 B(Star), R(5), // | 8424 B(Star), R(5), // |
8425 B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4), // | 8425 B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4), // |
8426 B(Star), R(2), // | 8426 B(Star), R(2), // |
8427 B(LdaInitialMap), // | 8427 B(LoadICSloppy), // |
rmcilroy
2016/02/08 15:05:21
Is this right? LoadIC needs operands to specify th
Michael Starzinger
2016/02/08 15:09:30
Yeah, this is just me being lazy and hoping we get
| |
8428 B(Star), R(3), // | 8428 B(Star), R(3), // |
8429 B(Mov), R(3), R(4), // | 8429 B(Mov), R(3), R(4), // |
8430 B(LdaConstant), U8(2), // | 8430 B(LdaConstant), U8(2), // |
8431 B(Star), R(5), // | 8431 B(Star), R(5), // |
8432 B(CreateClosure), U8(3), U8(0), // | 8432 B(CreateClosure), U8(3), U8(0), // |
8433 B(Star), R(6), // | 8433 B(Star), R(6), // |
8434 B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(4), U8(3), | 8434 B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(4), U8(3), |
8435 B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(2), U8(2), // | 8435 B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(2), U8(2), // |
8436 B(Star), R(0), // | 8436 B(Star), R(0), // |
8437 B(Star), R(1), // | 8437 B(Star), R(1), // |
(...skipping 20 matching lines...) Expand all Loading... | |
8458 B(LdaTheHole), // | 8458 B(LdaTheHole), // |
8459 B(Star), R(2), // | 8459 B(Star), R(2), // |
8460 B(CreateClosure), U8(0), U8(0), // | 8460 B(CreateClosure), U8(0), U8(0), // |
8461 B(Star), R(3), // | 8461 B(Star), R(3), // |
8462 B(LdaSmi8), U8(15), // | 8462 B(LdaSmi8), U8(15), // |
8463 B(Star), R(4), // | 8463 B(Star), R(4), // |
8464 B(LdaConstant), U8(1), // | 8464 B(LdaConstant), U8(1), // |
8465 B(Star), R(5), // | 8465 B(Star), R(5), // |
8466 B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4), // | 8466 B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4), // |
8467 B(Star), R(2), // | 8467 B(Star), R(2), // |
8468 B(LdaInitialMap), // | 8468 B(LoadICSloppy), // |
8469 B(Star), R(3), // | 8469 B(Star), R(3), // |
8470 B(Mov), R(3), R(4), // | 8470 B(Mov), R(3), R(4), // |
8471 B(LdaConstant), U8(2), // | 8471 B(LdaConstant), U8(2), // |
8472 B(Star), R(5), // | 8472 B(Star), R(5), // |
8473 B(CreateClosure), U8(3), U8(0), // | 8473 B(CreateClosure), U8(3), U8(0), // |
8474 B(Star), R(6), // | 8474 B(Star), R(6), // |
8475 B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(4), U8(3), | 8475 B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(4), U8(3), |
8476 B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(2), U8(2), // | 8476 B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(2), U8(2), // |
8477 B(Star), R(0), // | 8477 B(Star), R(0), // |
8478 B(Star), R(1), // | 8478 B(Star), R(1), // |
(...skipping 29 matching lines...) Expand all Loading... | |
8508 B(LdaTheHole), // | 8508 B(LdaTheHole), // |
8509 B(Star), R(3), // | 8509 B(Star), R(3), // |
8510 B(CreateClosure), U8(2), U8(0), // | 8510 B(CreateClosure), U8(2), U8(0), // |
8511 B(Star), R(4), // | 8511 B(Star), R(4), // |
8512 B(LdaSmi8), U8(41), // | 8512 B(LdaSmi8), U8(41), // |
8513 B(Star), R(5), // | 8513 B(Star), R(5), // |
8514 B(LdaSmi8), U8(107), // | 8514 B(LdaSmi8), U8(107), // |
8515 B(Star), R(6), // | 8515 B(Star), R(6), // |
8516 B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), // | 8516 B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), // |
8517 B(Star), R(3), // | 8517 B(Star), R(3), // |
8518 B(LdaInitialMap), // | 8518 B(LoadICSloppy), // |
8519 B(Star), R(4), // | 8519 B(Star), R(4), // |
8520 B(Mov), R(4), R(5), // | 8520 B(Mov), R(4), R(5), // |
8521 B(LdaContextSlot), R(context), U8(4), // | 8521 B(LdaContextSlot), R(context), U8(4), // |
8522 B(ToName), // | 8522 B(ToName), // |
8523 B(Star), R(6), // | 8523 B(Star), R(6), // |
8524 B(CreateClosure), U8(3), U8(0), // | 8524 B(CreateClosure), U8(3), U8(0), // |
8525 B(Star), R(7), // | 8525 B(Star), R(7), // |
8526 B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(5), U8(3), | 8526 B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(5), U8(3), |
8527 B(Mov), R(3), R(5), // | 8527 B(Mov), R(3), R(5), // |
8528 B(LdaContextSlot), R(context), U8(5), // | 8528 B(LdaContextSlot), R(context), U8(5), // |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8568 B(LdaTheHole), // | 8568 B(LdaTheHole), // |
8569 B(Star), R(3), // | 8569 B(Star), R(3), // |
8570 B(CreateClosure), U8(0), U8(0), // | 8570 B(CreateClosure), U8(0), U8(0), // |
8571 B(Star), R(4), // | 8571 B(Star), R(4), // |
8572 B(LdaSmi8), U8(30), // | 8572 B(LdaSmi8), U8(30), // |
8573 B(Star), R(5), // | 8573 B(Star), R(5), // |
8574 B(LdaSmi8), U8(67), // | 8574 B(LdaSmi8), U8(67), // |
8575 B(Star), R(6), // | 8575 B(Star), R(6), // |
8576 B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), // | 8576 B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), // |
8577 B(Star), R(3), // | 8577 B(Star), R(3), // |
8578 B(LdaInitialMap), // | 8578 B(LoadICSloppy), // |
8579 B(Star), R(4), // | 8579 B(Star), R(4), // |
8580 B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(3), U8(2), // | 8580 B(CallRuntime), U16(Runtime::kFinalizeClassDefinition), R(3), U8(2), // |
8581 B(Star), R(0), // | 8581 B(Star), R(0), // |
8582 B(Star), R(1), // | 8582 B(Star), R(1), // |
8583 B(Star), R(3), // | 8583 B(Star), R(3), // |
8584 B(New), R(3), R(0), U8(0), // | 8584 B(New), R(3), R(0), U8(0), // |
8585 B(Return), // | 8585 B(Return), // |
8586 }, | 8586 }, |
8587 1, | 8587 1, |
8588 { InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 8588 { InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
8589 }; | 8589 }; |
8590 // clang-format on | 8590 // clang-format on |
8591 | 8591 |
8592 for (size_t i = 0; i < arraysize(snippets); i++) { | 8592 for (size_t i = 0; i < arraysize(snippets); i++) { |
8593 Handle<BytecodeArray> bytecode_array = | 8593 Handle<BytecodeArray> bytecode_array = |
8594 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 8594 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
8595 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 8595 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
8596 } | 8596 } |
8597 } | 8597 } |
8598 | 8598 |
8599 } // namespace interpreter | 8599 } // namespace interpreter |
8600 } // namespace internal | 8600 } // namespace internal |
8601 } // namespace v8 | 8601 } // namespace v8 |
OLD | NEW |