Index: src/interpreter/interpreter.cc |
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
index b0be43e3096d6f6c67ba8bd6537094620814c9d2..9e1ca58a7ce8f94e589c8f603d10fd945bb44c36 100644 |
--- a/src/interpreter/interpreter.cc |
+++ b/src/interpreter/interpreter.cc |
@@ -382,9 +382,9 @@ void Interpreter::DoMov(InterpreterAssembler* assembler) { |
__ Dispatch(); |
} |
+template <typename Descriptor> |
Node* Interpreter::BuildLoadGlobal(Callable ic, |
InterpreterAssembler* assembler) { |
- typedef LoadGlobalWithVectorDescriptor Descriptor; |
// Get the global object. |
Node* context = __ GetContext(); |
@@ -403,9 +403,10 @@ Node* Interpreter::BuildLoadGlobal(Callable ic, |
// Load the global with name in constant pool entry <name_index> into the |
// accumulator using FeedBackVector slot <slot> outside of a typeof. |
void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
- Callable ic = |
+ auto ic = |
CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); |
- Node* result = BuildLoadGlobal(ic, assembler); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ Node* result = BuildLoadGlobal<Descriptor>(ic, assembler); |
__ SetAccumulator(result); |
__ Dispatch(); |
} |
@@ -415,9 +416,10 @@ void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
// Load the global with name in constant pool entry <name_index> into |
// register <reg> using FeedBackVector slot <slot> outside of a typeof. |
void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) { |
- Callable ic = |
+ auto ic = |
CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); |
- Node* result = BuildLoadGlobal(ic, assembler); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ Node* result = BuildLoadGlobal<Descriptor>(ic, assembler); |
Node* destination = __ BytecodeOperandReg(1); |
__ StoreRegister(result, destination); |
__ Dispatch(); |
@@ -428,15 +430,15 @@ void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) { |
// Load the global with name in constant pool entry <name_index> into the |
// accumulator using FeedBackVector slot <slot> inside of a typeof. |
void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { |
- Callable ic = |
- CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); |
- Node* result = BuildLoadGlobal(ic, assembler); |
+ auto ic = CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ Node* result = BuildLoadGlobal<Descriptor>(ic, assembler); |
__ SetAccumulator(result); |
__ Dispatch(); |
} |
+template <typename Descriptor> |
void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { |
- typedef StoreWithVectorDescriptor Descriptor; |
// Get the global object. |
Node* context = __ GetContext(); |
Node* native_context = |
@@ -463,8 +465,9 @@ void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { |
// Store the value in the accumulator into the global with name in constant pool |
// entry <name_index> using FeedBackVector slot <slot> in sloppy mode. |
void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { |
- Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY); |
- DoStaGlobal(ic, assembler); |
+ auto ic = CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ DoStaGlobal<Descriptor>(ic, assembler); |
} |
// StaGlobalStrict <name_index> <slot> |
@@ -472,8 +475,9 @@ void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { |
// Store the value in the accumulator into the global with name in constant pool |
// entry <name_index> using FeedBackVector slot <slot> in strict mode. |
void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { |
- Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); |
- DoStaGlobal(ic, assembler); |
+ auto ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ DoStaGlobal<Descriptor>(ic, assembler); |
} |
compiler::Node* Interpreter::BuildLoadContextSlot( |
@@ -571,9 +575,9 @@ void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { |
DoStaLookupSlot(LanguageMode::STRICT, assembler); |
} |
+template <typename Descriptor> |
Node* Interpreter::BuildLoadNamedProperty(Callable ic, |
InterpreterAssembler* assembler) { |
- typedef LoadWithVectorDescriptor Descriptor; |
Node* code_target = __ HeapConstant(ic.code()); |
Node* register_index = __ BytecodeOperandReg(0); |
Node* object = __ LoadRegister(register_index); |
@@ -594,8 +598,9 @@ Node* Interpreter::BuildLoadNamedProperty(Callable ic, |
// Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at |
// constant pool entry <name_index>. |
void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) { |
- Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_); |
- Node* result = BuildLoadNamedProperty(ic, assembler); |
+ auto ic = CodeFactory::LoadICInOptimizedCode(isolate_); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ Node* result = BuildLoadNamedProperty<Descriptor>(ic, assembler); |
__ SetAccumulator(result); |
__ Dispatch(); |
} |
@@ -605,16 +610,17 @@ void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) { |
// Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at |
// constant pool entry <name_index> and puts the result into register <reg>. |
void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) { |
- Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_); |
- Node* result = BuildLoadNamedProperty(ic, assembler); |
+ auto ic = CodeFactory::LoadICInOptimizedCode(isolate_); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ Node* result = BuildLoadNamedProperty<Descriptor>(ic, assembler); |
Node* destination = __ BytecodeOperandReg(3); |
__ StoreRegister(result, destination); |
__ Dispatch(); |
} |
+template <typename Descriptor> |
Node* Interpreter::BuildLoadKeyedProperty(Callable ic, |
InterpreterAssembler* assembler) { |
- typedef LoadWithVectorDescriptor Descriptor; |
Node* code_target = __ HeapConstant(ic.code()); |
Node* reg_index = __ BytecodeOperandReg(0); |
Node* object = __ LoadRegister(reg_index); |
@@ -634,8 +640,9 @@ Node* Interpreter::BuildLoadKeyedProperty(Callable ic, |
// Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
// in the accumulator. |
void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) { |
- Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); |
- Node* result = BuildLoadKeyedProperty(ic, assembler); |
+ auto ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ Node* result = BuildLoadKeyedProperty<Descriptor>(ic, assembler); |
__ SetAccumulator(result); |
__ Dispatch(); |
} |
@@ -645,15 +652,16 @@ void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) { |
// Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
// in the accumulator and puts the result in register <reg>. |
void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) { |
- Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); |
- Node* result = BuildLoadKeyedProperty(ic, assembler); |
+ auto ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ Node* result = BuildLoadKeyedProperty<Descriptor>(ic, assembler); |
Node* destination = __ BytecodeOperandReg(2); |
__ StoreRegister(result, destination); |
__ Dispatch(); |
} |
+template <typename Descriptor> |
void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { |
- typedef StoreWithVectorDescriptor Descriptor; |
Node* code_target = __ HeapConstant(ic.code()); |
Node* object_reg_index = __ BytecodeOperandReg(0); |
Node* object = __ LoadRegister(object_reg_index); |
@@ -677,8 +685,9 @@ void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { |
// the name in constant pool entry <name_index> with the value in the |
// accumulator. |
void Interpreter::DoStaNamedPropertySloppy(InterpreterAssembler* assembler) { |
- Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY); |
- DoStoreIC(ic, assembler); |
+ auto ic = CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ DoStoreIC<Descriptor>(ic, assembler); |
} |
// StaNamedPropertyStrict <object> <name_index> <slot> |
@@ -687,12 +696,13 @@ void Interpreter::DoStaNamedPropertySloppy(InterpreterAssembler* assembler) { |
// the name in constant pool entry <name_index> with the value in the |
// accumulator. |
void Interpreter::DoStaNamedPropertyStrict(InterpreterAssembler* assembler) { |
- Callable ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); |
- DoStoreIC(ic, assembler); |
+ auto ic = CodeFactory::StoreICInOptimizedCode(isolate_, STRICT); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ DoStoreIC<Descriptor>(ic, assembler); |
} |
+template <typename Descriptor> |
void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) { |
- typedef StoreWithVectorDescriptor Descriptor; |
Node* code_target = __ HeapConstant(ic.code()); |
Node* object_reg_index = __ BytecodeOperandReg(0); |
Node* object = __ LoadRegister(object_reg_index); |
@@ -715,8 +725,9 @@ void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) { |
// Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
// and the key <key> with the value in the accumulator. |
void Interpreter::DoStaKeyedPropertySloppy(InterpreterAssembler* assembler) { |
- Callable ic = CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY); |
- DoKeyedStoreIC(ic, assembler); |
+ auto ic = CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ DoKeyedStoreIC<Descriptor>(ic, assembler); |
} |
// StaKeyedPropertyStrict <object> <key> <slot> |
@@ -724,8 +735,9 @@ void Interpreter::DoStaKeyedPropertySloppy(InterpreterAssembler* assembler) { |
// Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
// and the key <key> with the value in the accumulator. |
void Interpreter::DoStaKeyedPropertyStrict(InterpreterAssembler* assembler) { |
- Callable ic = CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT); |
- DoKeyedStoreIC(ic, assembler); |
+ auto ic = CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT); |
+ typedef decltype(ic)::Descriptor Descriptor; |
+ DoKeyedStoreIC<Descriptor>(ic, assembler); |
} |
// PushContext <context> |
@@ -1016,7 +1028,7 @@ void Interpreter::DoShiftRightSmi(InterpreterAssembler* assembler) { |
__ Dispatch(); |
} |
-Node* Interpreter::BuildUnaryOp(Callable callable, |
+Node* Interpreter::BuildUnaryOp(const Callable& callable, |
InterpreterAssembler* assembler) { |
Node* target = __ HeapConstant(callable.code()); |
Node* accumulator = __ GetAccumulator(); |
@@ -1024,7 +1036,7 @@ Node* Interpreter::BuildUnaryOp(Callable callable, |
return __ CallStub(callable.descriptor(), target, context, accumulator); |
} |
-void Interpreter::DoUnaryOp(Callable callable, |
+void Interpreter::DoUnaryOp(const Callable& callable, |
InterpreterAssembler* assembler) { |
Node* result = BuildUnaryOp(callable, assembler); |
__ SetAccumulator(result); |