OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/builtins/builtins.h" |
| 6 #include "src/builtins/builtins-utils.h" |
| 7 #include "src/ic/handler-compiler.h" |
| 8 #include "src/ic/ic.h" |
| 9 |
| 10 namespace v8 { |
| 11 namespace internal { |
| 12 |
| 13 void Builtins::Generate_KeyedLoadIC_Megamorphic(MacroAssembler* masm) { |
| 14 KeyedLoadIC::GenerateMegamorphic(masm); |
| 15 } |
| 16 |
| 17 void Builtins::Generate_KeyedLoadIC_Miss(MacroAssembler* masm) { |
| 18 KeyedLoadIC::GenerateMiss(masm); |
| 19 } |
| 20 void Builtins::Generate_KeyedLoadIC_Slow(MacroAssembler* masm) { |
| 21 KeyedLoadIC::GenerateRuntimeGetProperty(masm); |
| 22 } |
| 23 |
| 24 void Builtins::Generate_KeyedStoreIC_Megamorphic(MacroAssembler* masm) { |
| 25 KeyedStoreIC::GenerateMegamorphic(masm, SLOPPY); |
| 26 } |
| 27 |
| 28 void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict(MacroAssembler* masm) { |
| 29 KeyedStoreIC::GenerateMegamorphic(masm, STRICT); |
| 30 } |
| 31 |
| 32 void Builtins::Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { |
| 33 KeyedStoreIC::GenerateMiss(masm); |
| 34 } |
| 35 |
| 36 void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { |
| 37 ElementHandlerCompiler::GenerateStoreSlow(masm); |
| 38 } |
| 39 |
| 40 void Builtins::Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) { |
| 41 typedef compiler::Node Node; |
| 42 |
| 43 Node* slot = assembler->Parameter(0); |
| 44 Node* vector = assembler->Parameter(1); |
| 45 Node* context = assembler->Parameter(2); |
| 46 |
| 47 assembler->TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, slot, |
| 48 vector); |
| 49 } |
| 50 |
| 51 namespace { |
| 52 void Generate_LoadGlobalIC_Slow(CodeStubAssembler* assembler, TypeofMode mode) { |
| 53 typedef compiler::Node Node; |
| 54 |
| 55 Node* slot = assembler->Parameter(0); |
| 56 Node* vector = assembler->Parameter(1); |
| 57 Node* context = assembler->Parameter(2); |
| 58 Node* typeof_mode = assembler->SmiConstant(Smi::FromInt(mode)); |
| 59 |
| 60 assembler->TailCallRuntime(Runtime::kGetGlobal, context, slot, vector, |
| 61 typeof_mode); |
| 62 } |
| 63 } // anonymous namespace |
| 64 |
| 65 void Builtins::Generate_LoadGlobalIC_SlowInsideTypeof( |
| 66 CodeStubAssembler* assembler) { |
| 67 Generate_LoadGlobalIC_Slow(assembler, INSIDE_TYPEOF); |
| 68 } |
| 69 |
| 70 void Builtins::Generate_LoadGlobalIC_SlowNotInsideTypeof( |
| 71 CodeStubAssembler* assembler) { |
| 72 Generate_LoadGlobalIC_Slow(assembler, NOT_INSIDE_TYPEOF); |
| 73 } |
| 74 |
| 75 void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { |
| 76 NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm); |
| 77 } |
| 78 |
| 79 void Builtins::Generate_LoadIC_Miss(CodeStubAssembler* assembler) { |
| 80 typedef compiler::Node Node; |
| 81 |
| 82 Node* receiver = assembler->Parameter(0); |
| 83 Node* name = assembler->Parameter(1); |
| 84 Node* slot = assembler->Parameter(2); |
| 85 Node* vector = assembler->Parameter(3); |
| 86 Node* context = assembler->Parameter(4); |
| 87 |
| 88 assembler->TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name, |
| 89 slot, vector); |
| 90 } |
| 91 |
| 92 void Builtins::Generate_LoadIC_Normal(MacroAssembler* masm) { |
| 93 LoadIC::GenerateNormal(masm); |
| 94 } |
| 95 |
| 96 void Builtins::Generate_LoadIC_Slow(CodeStubAssembler* assembler) { |
| 97 typedef compiler::Node Node; |
| 98 |
| 99 Node* receiver = assembler->Parameter(0); |
| 100 Node* name = assembler->Parameter(1); |
| 101 // Node* slot = assembler->Parameter(2); |
| 102 // Node* vector = assembler->Parameter(3); |
| 103 Node* context = assembler->Parameter(4); |
| 104 |
| 105 assembler->TailCallRuntime(Runtime::kGetProperty, context, receiver, name); |
| 106 } |
| 107 |
| 108 void Builtins::Generate_StoreIC_Miss(CodeStubAssembler* assembler) { |
| 109 typedef compiler::Node Node; |
| 110 |
| 111 Node* receiver = assembler->Parameter(0); |
| 112 Node* name = assembler->Parameter(1); |
| 113 Node* value = assembler->Parameter(2); |
| 114 Node* slot = assembler->Parameter(3); |
| 115 Node* vector = assembler->Parameter(4); |
| 116 Node* context = assembler->Parameter(5); |
| 117 |
| 118 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, receiver, name, |
| 119 value, slot, vector); |
| 120 } |
| 121 |
| 122 void Builtins::Generate_StoreIC_Normal(MacroAssembler* masm) { |
| 123 StoreIC::GenerateNormal(masm); |
| 124 } |
| 125 |
| 126 void Builtins::Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { |
| 127 NamedStoreHandlerCompiler::GenerateStoreViaSetterForDeopt(masm); |
| 128 } |
| 129 |
| 130 namespace { |
| 131 void Generate_StoreIC_Slow(CodeStubAssembler* assembler, |
| 132 LanguageMode language_mode) { |
| 133 typedef compiler::Node Node; |
| 134 |
| 135 Node* receiver = assembler->Parameter(0); |
| 136 Node* name = assembler->Parameter(1); |
| 137 Node* value = assembler->Parameter(2); |
| 138 // Node* slot = assembler->Parameter(3); |
| 139 // Node* vector = assembler->Parameter(4); |
| 140 Node* context = assembler->Parameter(5); |
| 141 Node* lang_mode = assembler->SmiConstant(Smi::FromInt(language_mode)); |
| 142 |
| 143 // The slow case calls into the runtime to complete the store without causing |
| 144 // an IC miss that would otherwise cause a transition to the generic stub. |
| 145 assembler->TailCallRuntime(Runtime::kSetProperty, context, receiver, name, |
| 146 value, lang_mode); |
| 147 } |
| 148 } // anonymous namespace |
| 149 |
| 150 void Builtins::Generate_StoreIC_SlowSloppy(CodeStubAssembler* assembler) { |
| 151 Generate_StoreIC_Slow(assembler, SLOPPY); |
| 152 } |
| 153 |
| 154 void Builtins::Generate_StoreIC_SlowStrict(CodeStubAssembler* assembler) { |
| 155 Generate_StoreIC_Slow(assembler, STRICT); |
| 156 } |
| 157 |
| 158 } // namespace internal |
| 159 } // namespace v8 |
OLD | NEW |