| 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 // TODO(rmcilroy): Remove this define after this flag is turned on globally | 5 // TODO(rmcilroy): Remove this define after this flag is turned on globally |
| 6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 2690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2701 } | 2701 } |
| 2702 } | 2702 } |
| 2703 | 2703 |
| 2704 | 2704 |
| 2705 TEST(GlobalDelete) { | 2705 TEST(GlobalDelete) { |
| 2706 InitializedHandleScope handle_scope; | 2706 InitializedHandleScope handle_scope; |
| 2707 BytecodeGeneratorHelper helper; | 2707 BytecodeGeneratorHelper helper; |
| 2708 Zone zone; | 2708 Zone zone; |
| 2709 | 2709 |
| 2710 int context = Register::function_context().index(); | 2710 int context = Register::function_context().index(); |
| 2711 int global_object_index = Context::GLOBAL_OBJECT_INDEX; | 2711 int native_context_index = Context::NATIVE_CONTEXT_INDEX; |
| 2712 int global_context_index = Context::EXTENSION_INDEX; |
| 2712 FeedbackVectorSpec feedback_spec(&zone); | 2713 FeedbackVectorSpec feedback_spec(&zone); |
| 2713 FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); | 2714 FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); |
| 2714 | 2715 |
| 2715 Handle<i::TypeFeedbackVector> vector = | 2716 Handle<i::TypeFeedbackVector> vector = |
| 2716 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); | 2717 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); |
| 2717 | 2718 |
| 2718 ExpectedSnippet<InstanceType> snippets[] = { | 2719 ExpectedSnippet<InstanceType> snippets[] = { |
| 2719 {"var a = {x:13, y:14};\n function f() { return delete a.x; };\n f();", | 2720 {"var a = {x:13, y:14};\n function f() { return delete a.x; };\n f();", |
| 2720 1 * kPointerSize, | 2721 1 * kPointerSize, |
| 2721 1, | 2722 1, |
| 2722 10, | 2723 10, |
| 2723 { | 2724 {B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot)), // |
| 2724 B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot)), // | 2725 B(Star), R(0), // |
| 2725 B(Star), R(0), // | 2726 B(LdaConstant), U8(1), // |
| 2726 B(LdaConstant), U8(1), // | 2727 B(DeletePropertySloppy), R(0), // |
| 2727 B(DeletePropertySloppy), R(0), // | 2728 B(Return)}, |
| 2728 B(Return) | |
| 2729 }, | |
| 2730 2, | 2729 2, |
| 2731 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, | 2730 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, |
| 2732 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 2731 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 2733 {"a = {1:13, 2:14};\n" | 2732 {"a = {1:13, 2:14};\n" |
| 2734 "function f() {'use strict'; return delete a[1];};\n f();", | 2733 "function f() {'use strict'; return delete a[1];};\n f();", |
| 2735 1 * kPointerSize, | 2734 1 * kPointerSize, |
| 2736 1, | 2735 1, |
| 2737 10, | 2736 10, |
| 2738 { | 2737 {B(LdaGlobalStrict), U8(0), U8(vector->GetIndex(slot)), // |
| 2739 B(LdaGlobalStrict), U8(0), U8(vector->GetIndex(slot)), // | 2738 B(Star), R(0), // |
| 2740 B(Star), R(0), // | 2739 B(LdaSmi8), U8(1), // |
| 2741 B(LdaSmi8), U8(1), // | 2740 B(DeletePropertyStrict), R(0), // |
| 2742 B(DeletePropertyStrict), R(0), // | 2741 B(Return)}, |
| 2743 B(Return) | |
| 2744 }, | |
| 2745 1, | 2742 1, |
| 2746 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 2743 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 2747 {"var a = {x:13, y:14};\n function f() { return delete a; };\n f();", | 2744 {"var a = {x:13, y:14};\n function f() { return delete a; };\n f();", |
| 2748 1 * kPointerSize, | 2745 2 * kPointerSize, |
| 2749 1, | 2746 1, |
| 2750 10, | 2747 15, |
| 2751 { | 2748 {B(LdaContextSlot), R(context), U8(native_context_index), // |
| 2752 B(LdaContextSlot), R(context), U8(global_object_index), // | 2749 B(Star), R(0), // |
| 2753 B(Star), R(0), // | 2750 B(LdaContextSlot), R(0), U8(global_context_index), // |
| 2754 B(LdaConstant), U8(0), // | 2751 B(Star), R(1), // |
| 2755 B(DeletePropertySloppy), R(0), // | 2752 B(LdaConstant), U8(0), // |
| 2756 B(Return) | 2753 B(DeletePropertySloppy), R(1), // |
| 2757 }, | 2754 B(Return)}, |
| 2758 1, | 2755 1, |
| 2759 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 2756 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 2760 {"b = 30;\n function f() { return delete b; };\n f();", | 2757 {"b = 30;\n function f() { return delete b; };\n f();", |
| 2761 1 * kPointerSize, | 2758 2 * kPointerSize, |
| 2762 1, | 2759 1, |
| 2763 10, | 2760 15, |
| 2764 { | 2761 {B(LdaContextSlot), R(context), U8(native_context_index), // |
| 2765 B(LdaContextSlot), R(context), U8(global_object_index), // | 2762 B(Star), R(0), // |
| 2766 B(Star), R(0), // | 2763 B(LdaContextSlot), R(0), U8(global_context_index), // |
| 2767 B(LdaConstant), U8(0), // | 2764 B(Star), R(1), // |
| 2768 B(DeletePropertySloppy), R(0), // | 2765 B(LdaConstant), U8(0), // |
| 2769 B(Return) | 2766 B(DeletePropertySloppy), R(1), // |
| 2770 }, | 2767 B(Return)}, |
| 2771 1, | 2768 1, |
| 2772 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}}; | 2769 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}}; |
| 2773 | 2770 |
| 2774 for (size_t i = 0; i < arraysize(snippets); i++) { | 2771 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 2775 Handle<BytecodeArray> bytecode_array = | 2772 Handle<BytecodeArray> bytecode_array = |
| 2776 helper.MakeBytecode(snippets[i].code_snippet, "f"); | 2773 helper.MakeBytecode(snippets[i].code_snippet, "f"); |
| 2777 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 2774 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 2778 } | 2775 } |
| 2779 } | 2776 } |
| 2780 | 2777 |
| (...skipping 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5465 for (size_t i = 0; i < arraysize(snippets); i++) { | 5462 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 5466 Handle<BytecodeArray> bytecode_array = | 5463 Handle<BytecodeArray> bytecode_array = |
| 5467 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 5464 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 5468 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 5465 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 5469 } | 5466 } |
| 5470 } | 5467 } |
| 5471 | 5468 |
| 5472 } // namespace interpreter | 5469 } // namespace interpreter |
| 5473 } // namespace internal | 5470 } // namespace internal |
| 5474 } // namespace v8 | 5471 } // namespace v8 |
| OLD | NEW |