| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // | 223 // |
| 224 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name | 224 // Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name |
| 225 // in the accumulator. | 225 // in the accumulator. |
| 226 void Interpreter::DoLoadIC(compiler::InterpreterAssembler* assembler) { | 226 void Interpreter::DoLoadIC(compiler::InterpreterAssembler* assembler) { |
| 227 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, | 227 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| 228 SLOPPY, UNINITIALIZED); | 228 SLOPPY, UNINITIALIZED); |
| 229 DoPropertyLoadIC(ic, assembler); | 229 DoPropertyLoadIC(ic, assembler); |
| 230 } | 230 } |
| 231 | 231 |
| 232 | 232 |
| 233 // LoadICStrict <object> <slot> |
| 234 // |
| 235 // Calls the strict mode LoadIC at FeedBackVector slot <slot> for <object> and |
| 236 // the name in the accumulator. |
| 237 void Interpreter::DoLoadICStrict(compiler::InterpreterAssembler* assembler) { |
| 238 Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| 239 STRICT, UNINITIALIZED); |
| 240 DoPropertyLoadIC(ic, assembler); |
| 241 } |
| 242 |
| 243 |
| 233 // KeyedLoadIC <object> <slot> | 244 // KeyedLoadIC <object> <slot> |
| 234 // | 245 // |
| 235 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key | 246 // Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
| 236 // in the accumulator. | 247 // in the accumulator. |
| 237 void Interpreter::DoKeyedLoadIC(compiler::InterpreterAssembler* assembler) { | 248 void Interpreter::DoKeyedLoadIC(compiler::InterpreterAssembler* assembler) { |
| 238 Callable ic = | 249 Callable ic = |
| 239 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | 250 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
| 240 DoPropertyLoadIC(ic, assembler); | 251 DoPropertyLoadIC(ic, assembler); |
| 241 } | 252 } |
| 242 | 253 |
| 243 | 254 |
| 255 // KeyedLoadICStrict <object> <slot> |
| 256 // |
| 257 // Calls the strict mode KeyedLoadIC at FeedBackVector slot <slot> for <object> |
| 258 // and the key in the accumulator. |
| 259 void Interpreter::DoKeyedLoadICStrict( |
| 260 compiler::InterpreterAssembler* assembler) { |
| 261 Callable ic = |
| 262 CodeFactory::KeyedLoadICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); |
| 263 DoPropertyLoadIC(ic, assembler); |
| 264 } |
| 265 |
| 266 |
| 244 void Interpreter::DoPropertyStoreIC(Callable ic, | 267 void Interpreter::DoPropertyStoreIC(Callable ic, |
| 245 compiler::InterpreterAssembler* assembler) { | 268 compiler::InterpreterAssembler* assembler) { |
| 246 Node* code_target = __ HeapConstant(ic.code()); | 269 Node* code_target = __ HeapConstant(ic.code()); |
| 247 Node* object_reg_index = __ BytecodeOperandReg8(0); | 270 Node* object_reg_index = __ BytecodeOperandReg8(0); |
| 248 Node* object = __ LoadRegister(object_reg_index); | 271 Node* object = __ LoadRegister(object_reg_index); |
| 249 Node* name_reg_index = __ BytecodeOperandReg8(1); | 272 Node* name_reg_index = __ BytecodeOperandReg8(1); |
| 250 Node* name = __ LoadRegister(name_reg_index); | 273 Node* name = __ LoadRegister(name_reg_index); |
| 251 Node* value = __ GetAccumulator(); | 274 Node* value = __ GetAccumulator(); |
| 252 Node* raw_slot = __ BytecodeOperandIdx8(2); | 275 Node* raw_slot = __ BytecodeOperandIdx8(2); |
| 253 Node* smi_slot = __ SmiTag(raw_slot); | 276 Node* smi_slot = __ SmiTag(raw_slot); |
| 254 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 277 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| 255 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, value, | 278 Node* result = __ CallIC(ic.descriptor(), code_target, object, name, value, |
| 256 smi_slot, type_feedback_vector); | 279 smi_slot, type_feedback_vector); |
| 257 __ SetAccumulator(result); | 280 __ SetAccumulator(result); |
| 258 __ Dispatch(); | 281 __ Dispatch(); |
| 259 } | 282 } |
| 260 | 283 |
| 261 | 284 |
| 262 // StoreIC <object> <name> <slot> | 285 // StoreIC <object> <name> <slot> |
| 263 // | 286 // |
| 264 // Calls the StoreIC at FeedBackVector slot <slot> for <object> and the name | 287 // Calls the StoreIC at FeedBackVector slot <slot> for <object> and the name |
| 265 // <name> with the value in the accumulator. | 288 // <name> with the value in the accumulator. |
| 266 void Interpreter::DoStoreIC(compiler::InterpreterAssembler* assembler) { | 289 void Interpreter::DoStoreIC(compiler::InterpreterAssembler* assembler) { |
| 267 Callable ic = | 290 Callable ic = |
| 268 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | 291 CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
| 269 DoPropertyStoreIC(ic, assembler); | 292 DoPropertyStoreIC(ic, assembler); |
| 270 } | 293 } |
| 271 | 294 |
| 272 | 295 |
| 296 // StoreICStrict <object> <name> <slot> |
| 297 // |
| 298 // Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and |
| 299 // the name <name> with the value in the accumulator. |
| 300 void Interpreter::DoStoreICStrict(compiler::InterpreterAssembler* assembler) { |
| 301 Callable ic = |
| 302 CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); |
| 303 DoPropertyStoreIC(ic, assembler); |
| 304 } |
| 305 |
| 306 |
| 273 // KeyedStoreIC <object> <key> <slot> | 307 // KeyedStoreIC <object> <key> <slot> |
| 274 // | 308 // |
| 275 // Calls the KeyStoreIC at FeedBackVector slot <slot> for <object> and the key | 309 // Calls the KeyStoreIC at FeedBackVector slot <slot> for <object> and the key |
| 276 // <key> with the value in the accumulator. | 310 // <key> with the value in the accumulator. |
| 277 void Interpreter::DoKeyedStoreIC(compiler::InterpreterAssembler* assembler) { | 311 void Interpreter::DoKeyedStoreIC(compiler::InterpreterAssembler* assembler) { |
| 278 Callable ic = | 312 Callable ic = |
| 279 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); | 313 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
| 280 DoPropertyStoreIC(ic, assembler); | 314 DoPropertyStoreIC(ic, assembler); |
| 281 } | 315 } |
| 282 | 316 |
| 283 | 317 |
| 318 // KeyedStoreICStore <object> <key> <slot> |
| 319 // |
| 320 // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
| 321 // and the key <key> with the value in the accumulator. |
| 322 void Interpreter::DoKeyedStoreICStrict( |
| 323 compiler::InterpreterAssembler* assembler) { |
| 324 Callable ic = |
| 325 CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); |
| 326 DoPropertyStoreIC(ic, assembler); |
| 327 } |
| 328 |
| 329 |
| 284 void Interpreter::DoBinaryOp(Runtime::FunctionId function_id, | 330 void Interpreter::DoBinaryOp(Runtime::FunctionId function_id, |
| 285 compiler::InterpreterAssembler* assembler) { | 331 compiler::InterpreterAssembler* assembler) { |
| 286 // TODO(rmcilroy): Call ICs which back-patch bytecode with type specialized | 332 // TODO(rmcilroy): Call ICs which back-patch bytecode with type specialized |
| 287 // operations, instead of calling builtins directly. | 333 // operations, instead of calling builtins directly. |
| 288 Node* reg_index = __ BytecodeOperandReg8(0); | 334 Node* reg_index = __ BytecodeOperandReg8(0); |
| 289 Node* lhs = __ LoadRegister(reg_index); | 335 Node* lhs = __ LoadRegister(reg_index); |
| 290 Node* rhs = __ GetAccumulator(); | 336 Node* rhs = __ GetAccumulator(); |
| 291 Node* result = __ CallRuntime(function_id, lhs, rhs); | 337 Node* result = __ CallRuntime(function_id, lhs, rhs); |
| 292 __ SetAccumulator(result); | 338 __ SetAccumulator(result); |
| 293 __ Dispatch(); | 339 __ Dispatch(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 // | 572 // |
| 527 // Return the value in register 0. | 573 // Return the value in register 0. |
| 528 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 574 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
| 529 __ Return(); | 575 __ Return(); |
| 530 } | 576 } |
| 531 | 577 |
| 532 | 578 |
| 533 } // namespace interpreter | 579 } // namespace interpreter |
| 534 } // namespace internal | 580 } // namespace internal |
| 535 } // namespace v8 | 581 } // namespace v8 |
| OLD | NEW |