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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1064 | 1064 |
1065 | 1065 |
1066 // Return | 1066 // Return |
1067 // | 1067 // |
1068 // Return the value in the accumulator. | 1068 // Return the value in the accumulator. |
1069 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 1069 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
1070 __ Return(); | 1070 __ Return(); |
1071 } | 1071 } |
1072 | 1072 |
1073 | 1073 |
1074 // ForInPrepare | |
1075 // | |
1076 // Returns state for for..in loop execution based on the JSObject in | |
1077 // the accumulator. | |
1078 void Interpreter::DoForInPrepare(compiler::InterpreterAssembler* assembler) { | |
1079 Node* js_object = __ GetAccumulator(); | |
1080 Node* result = __ CallRuntime(Runtime::kInterpreterForInPrepare, js_object); | |
1081 __ SetAccumulator(result); | |
1082 __ Dispatch(); | |
1083 } | |
1084 | |
1085 | |
1086 // ForInNext <for_in_prepared> | |
rmcilroy
2015/10/26 14:04:01
/s/for_in_prepared/for_in_state
oth
2015/10/28 11:53:12
Done.
| |
1087 // | |
1088 // Returns the next key in a for..in loop. The accumulator contains the current | |
1089 // zero-based iteration count and <for_in_prepared> is the state returned by | |
1090 // earlier | |
1091 // invocation of ForInPrepare. | |
rmcilroy
2015/10/26 14:04:01
remove extra newline
oth
2015/10/28 11:53:12
Done.
| |
1092 void Interpreter::DoForInNext(compiler::InterpreterAssembler* assembler) { | |
1093 Node* index = __ GetAccumulator(); | |
1094 Node* for_in_state_reg = __ BytecodeOperandReg8(0); | |
1095 Node* for_in_state = __ LoadRegister(for_in_state_reg); | |
1096 Node* receiver = __ LoadFixedArrayElement(for_in_state, 0); | |
1097 Node* cache_array = __ LoadFixedArrayElement(for_in_state, 1); | |
1098 Node* cache_type = __ LoadFixedArrayElement(for_in_state, 2); | |
1099 Node* result = __ CallRuntime(Runtime::kForInNext, receiver, cache_array, | |
1100 cache_type, index); | |
1101 __ SetAccumulator(result); | |
1102 __ Dispatch(); | |
1103 } | |
1104 | |
1105 | |
1106 // ForInDone <for_in_prepared> | |
1107 // | |
1108 // Returns the next key in a for..in loop. The accumulator contains the current | |
1109 // zero-based iteration count and <for_in_prepared> is the state returned by | |
1110 // earlier | |
1111 // invocation of ForInPrepare. | |
rmcilroy
2015/10/26 14:04:01
ditto
oth
2015/10/28 11:53:12
Done.
| |
1112 void Interpreter::DoForInDone(compiler::InterpreterAssembler* assembler) { | |
1113 Node* index = __ GetAccumulator(); | |
1114 Node* for_in_state_reg = __ BytecodeOperandReg8(0); | |
1115 Node* for_in_state = __ LoadRegister(for_in_state_reg); | |
1116 Node* cache_length = __ LoadFixedArrayElement(for_in_state, 3); | |
1117 Node* result = __ CallRuntime(Runtime::kForInDone, index, cache_length); | |
1118 __ SetAccumulator(result); | |
1119 __ Dispatch(); | |
1120 } | |
1121 | |
1122 | |
1074 } // namespace interpreter | 1123 } // namespace interpreter |
1075 } // namespace internal | 1124 } // namespace internal |
1076 } // namespace v8 | 1125 } // namespace v8 |
OLD | NEW |