| 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/interpreter/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/compiler/interpreter-assembler.h" | 9 #include "src/compiler/interpreter-assembler.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // in the accumulator. | 213 // in the accumulator. |
| 214 void Interpreter::DoLoadIC(compiler::InterpreterAssembler* assembler) { | 214 void Interpreter::DoLoadIC(compiler::InterpreterAssembler* assembler) { |
| 215 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | 215 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| 216 SLOPPY, UNINITIALIZED); | 216 SLOPPY, UNINITIALIZED); |
| 217 DoPropertyLoadIC(ic, assembler); | 217 DoPropertyLoadIC(ic, assembler); |
| 218 } | 218 } |
| 219 | 219 |
| 220 | 220 |
| 221 // KeyedLoadIC <object> <slot> | 221 // KeyedLoadIC <object> <slot> |
| 222 // | 222 // |
| 223 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the key | 223 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
| 224 // in the accumulator. | 224 // in the accumulator. |
| 225 void Interpreter::DoKeyedLoadIC(compiler::InterpreterAssembler* assembler) { | 225 void Interpreter::DoKeyedLoadIC(compiler::InterpreterAssembler* assembler) { |
| 226 Callable ic = | 226 Callable ic = |
| 227 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | 227 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
| 228 DoPropertyLoadIC(ic, assembler); | 228 DoPropertyLoadIC(ic, assembler); |
| 229 } | 229 } |
| 230 | 230 |
| 231 | 231 |
| 232 void Interpreter::DoPropertyStoreIC(Callable ic, |
| 233 compiler::InterpreterAssembler* assembler) { |
| 234 Node* code_target = __ HeapConstant(ic.code()); |
| 235 Node* object_reg_index = __ BytecodeOperandReg(0); |
| 236 Node* object = __ LoadRegister(object_reg_index); |
| 237 Node* name_reg_index = __ BytecodeOperandReg(1); |
| 238 Node* name = __ LoadRegister(name_reg_index); |
| 239 Node* value = __ GetAccumulator(); |
| 240 Node* raw_slot = __ BytecodeOperandIdx(2); |
| 241 Node* smi_slot = __ SmiTag(raw_slot); |
| 242 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 243 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, value, |
| 244 smi_slot, type_feedback_vector); |
| 245 __ SetAccumulator(result); |
| 246 __ Dispatch(); |
| 247 } |
| 248 |
| 249 |
| 250 // StoreIC <object> <name> <slot> |
| 251 // |
| 252 // Calls the StoreIC at FeedBackVector slot <slot> for <object> and the name |
| 253 // <name> with the value in the accumulator. |
| 254 void Interpreter::DoStoreIC(compiler::InterpreterAssembler* assembler) { |
| 255 Callable ic = |
| 256 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
| 257 DoPropertyStoreIC(ic, assembler); |
| 258 } |
| 259 |
| 260 |
| 261 // KeyedStoreIC <object> <key> <slot> |
| 262 // |
| 263 // Calls the KeyStoreIC at FeedBackVector slot <slot> for <object> and the key |
| 264 // <key> with the value in the accumulator. |
| 265 void Interpreter::DoKeyedStoreIC(compiler::InterpreterAssembler* assembler) { |
| 266 Callable ic = |
| 267 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
| 268 DoPropertyStoreIC(ic, assembler); |
| 269 } |
| 270 |
| 271 |
| 232 void Interpreter::DoBinaryOp(int builtin_context_index, | 272 void Interpreter::DoBinaryOp(int builtin_context_index, |
| 233 compiler::InterpreterAssembler* assembler) { | 273 compiler::InterpreterAssembler* assembler) { |
| 234 // TODO(rmcilroy): Call ICs which back-patch bytecode with type specialized | 274 // TODO(rmcilroy): Call ICs which back-patch bytecode with type specialized |
| 235 // operations, instead of calling builtins directly. | 275 // operations, instead of calling builtins directly. |
| 236 Node* reg_index = __ BytecodeOperandReg(0); | 276 Node* reg_index = __ BytecodeOperandReg(0); |
| 237 Node* lhs = __ LoadRegister(reg_index); | 277 Node* lhs = __ LoadRegister(reg_index); |
| 238 Node* rhs = __ GetAccumulator(); | 278 Node* rhs = __ GetAccumulator(); |
| 239 Node* result = __ CallJSBuiltin(builtin_context_index, lhs, rhs); | 279 Node* result = __ CallJSBuiltin(builtin_context_index, lhs, rhs); |
| 240 __ SetAccumulator(result); | 280 __ SetAccumulator(result); |
| 241 __ Dispatch(); | 281 __ Dispatch(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // | 326 // |
| 287 // Return the value in register 0. | 327 // Return the value in register 0. |
| 288 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 328 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
| 289 __ Return(); | 329 __ Return(); |
| 290 } | 330 } |
| 291 | 331 |
| 292 | 332 |
| 293 } // namespace interpreter | 333 } // namespace interpreter |
| 294 } // namespace internal | 334 } // namespace internal |
| 295 } // namespace v8 | 335 } // namespace v8 |
| OLD | NEW |