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 <fstream> | 7 #include <fstream> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 Node* right = __ SmiTag(raw_int); | 1219 Node* right = __ SmiTag(raw_int); |
1220 Node* slot_index = __ BytecodeOperandIdx(2); | 1220 Node* slot_index = __ BytecodeOperandIdx(2); |
1221 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 1221 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
1222 | 1222 |
1223 // {right} is known to be a Smi. | 1223 // {right} is known to be a Smi. |
1224 // Check if the {left} is a Smi take the fast path. | 1224 // Check if the {left} is a Smi take the fast path. |
1225 __ BranchIf(__ TaggedIsSmi(left), &fastpath, &slowpath); | 1225 __ BranchIf(__ TaggedIsSmi(left), &fastpath, &slowpath); |
1226 __ Bind(&fastpath); | 1226 __ Bind(&fastpath); |
1227 { | 1227 { |
1228 // Try fast Smi addition first. | 1228 // Try fast Smi addition first. |
1229 Node* pair = __ SmiAddWithOverflow(left, right); | 1229 Node* pair = __ IntPtrAddWithOverflow(__ BitcastTaggedToWord(left), |
| 1230 __ BitcastTaggedToWord(right)); |
1230 Node* overflow = __ Projection(1, pair); | 1231 Node* overflow = __ Projection(1, pair); |
1231 | 1232 |
1232 // Check if the Smi additon overflowed. | 1233 // Check if the Smi additon overflowed. |
1233 Label if_notoverflow(assembler); | 1234 Label if_notoverflow(assembler); |
1234 __ BranchIf(overflow, &slowpath, &if_notoverflow); | 1235 __ BranchIf(overflow, &slowpath, &if_notoverflow); |
1235 __ Bind(&if_notoverflow); | 1236 __ Bind(&if_notoverflow); |
1236 { | 1237 { |
1237 __ UpdateFeedback(__ Int32Constant(BinaryOperationFeedback::kSignedSmall), | 1238 __ UpdateFeedback(__ Int32Constant(BinaryOperationFeedback::kSignedSmall), |
1238 type_feedback_vector, slot_index); | 1239 type_feedback_vector, slot_index); |
1239 var_result.Bind(__ Projection(0, pair)); | 1240 var_result.Bind(__ BitcastWordToTaggedSigned(__ Projection(0, pair))); |
1240 __ Goto(&end); | 1241 __ Goto(&end); |
1241 } | 1242 } |
1242 } | 1243 } |
1243 __ Bind(&slowpath); | 1244 __ Bind(&slowpath); |
1244 { | 1245 { |
1245 Node* context = __ GetContext(); | 1246 Node* context = __ GetContext(); |
1246 AddWithFeedbackStub stub(__ isolate()); | 1247 AddWithFeedbackStub stub(__ isolate()); |
1247 Callable callable = | 1248 Callable callable = |
1248 Callable(stub.GetCode(), AddWithFeedbackStub::Descriptor(__ isolate())); | 1249 Callable(stub.GetCode(), AddWithFeedbackStub::Descriptor(__ isolate())); |
1249 Node* args[] = {left, right, slot_index, type_feedback_vector, context}; | 1250 Node* args[] = {left, right, slot_index, type_feedback_vector, context}; |
(...skipping 22 matching lines...) Expand all Loading... |
1272 Node* right = __ SmiTag(raw_int); | 1273 Node* right = __ SmiTag(raw_int); |
1273 Node* slot_index = __ BytecodeOperandIdx(2); | 1274 Node* slot_index = __ BytecodeOperandIdx(2); |
1274 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 1275 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
1275 | 1276 |
1276 // {right} is known to be a Smi. | 1277 // {right} is known to be a Smi. |
1277 // Check if the {left} is a Smi take the fast path. | 1278 // Check if the {left} is a Smi take the fast path. |
1278 __ BranchIf(__ TaggedIsSmi(left), &fastpath, &slowpath); | 1279 __ BranchIf(__ TaggedIsSmi(left), &fastpath, &slowpath); |
1279 __ Bind(&fastpath); | 1280 __ Bind(&fastpath); |
1280 { | 1281 { |
1281 // Try fast Smi subtraction first. | 1282 // Try fast Smi subtraction first. |
1282 Node* pair = __ SmiSubWithOverflow(left, right); | 1283 Node* pair = __ IntPtrSubWithOverflow(__ BitcastTaggedToWord(left), |
| 1284 __ BitcastTaggedToWord(right)); |
1283 Node* overflow = __ Projection(1, pair); | 1285 Node* overflow = __ Projection(1, pair); |
1284 | 1286 |
1285 // Check if the Smi subtraction overflowed. | 1287 // Check if the Smi subtraction overflowed. |
1286 Label if_notoverflow(assembler); | 1288 Label if_notoverflow(assembler); |
1287 __ BranchIf(overflow, &slowpath, &if_notoverflow); | 1289 __ BranchIf(overflow, &slowpath, &if_notoverflow); |
1288 __ Bind(&if_notoverflow); | 1290 __ Bind(&if_notoverflow); |
1289 { | 1291 { |
1290 __ UpdateFeedback(__ Int32Constant(BinaryOperationFeedback::kSignedSmall), | 1292 __ UpdateFeedback(__ Int32Constant(BinaryOperationFeedback::kSignedSmall), |
1291 type_feedback_vector, slot_index); | 1293 type_feedback_vector, slot_index); |
1292 var_result.Bind(__ Projection(0, pair)); | 1294 var_result.Bind(__ BitcastWordToTaggedSigned(__ Projection(0, pair))); |
1293 __ Goto(&end); | 1295 __ Goto(&end); |
1294 } | 1296 } |
1295 } | 1297 } |
1296 __ Bind(&slowpath); | 1298 __ Bind(&slowpath); |
1297 { | 1299 { |
1298 Node* context = __ GetContext(); | 1300 Node* context = __ GetContext(); |
1299 SubtractWithFeedbackStub stub(__ isolate()); | 1301 SubtractWithFeedbackStub stub(__ isolate()); |
1300 Callable callable = Callable( | 1302 Callable callable = Callable( |
1301 stub.GetCode(), SubtractWithFeedbackStub::Descriptor(__ isolate())); | 1303 stub.GetCode(), SubtractWithFeedbackStub::Descriptor(__ isolate())); |
1302 Node* args[] = {left, right, slot_index, type_feedback_vector, context}; | 1304 Node* args[] = {left, right, slot_index, type_feedback_vector, context}; |
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2637 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2636 __ SmiTag(new_state)); | 2638 __ SmiTag(new_state)); |
2637 __ SetAccumulator(old_state); | 2639 __ SetAccumulator(old_state); |
2638 | 2640 |
2639 __ Dispatch(); | 2641 __ Dispatch(); |
2640 } | 2642 } |
2641 | 2643 |
2642 } // namespace interpreter | 2644 } // namespace interpreter |
2643 } // namespace internal | 2645 } // namespace internal |
2644 } // namespace v8 | 2646 } // namespace v8 |
OLD | NEW |