OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 const FullCodeGenerator::InlineFunctionGenerator | 664 const FullCodeGenerator::InlineFunctionGenerator |
665 FullCodeGenerator::kInlineFunctionGenerators[] = { | 665 FullCodeGenerator::kInlineFunctionGenerators[] = { |
666 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) | 666 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) |
667 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) | 667 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) |
668 }; | 668 }; |
669 #undef INLINE_FUNCTION_GENERATOR_ADDRESS | 669 #undef INLINE_FUNCTION_GENERATOR_ADDRESS |
670 | 670 |
671 | 671 |
672 FullCodeGenerator::InlineFunctionGenerator | 672 FullCodeGenerator::InlineFunctionGenerator |
673 FullCodeGenerator::FindInlineFunctionGenerator(Runtime::FunctionId id) { | 673 FullCodeGenerator::FindInlineFunctionGenerator(Runtime::FunctionId id) { |
674 return kInlineFunctionGenerators[ | 674 int lookup_index = |
675 static_cast<int>(id) - static_cast<int>(Runtime::kFirstInlineFunction)]; | 675 static_cast<int>(id) - static_cast<int>(Runtime::kFirstInlineFunction); |
| 676 ASSERT(lookup_index >= 0); |
| 677 ASSERT(static_cast<size_t>(lookup_index) < |
| 678 ARRAY_SIZE(kInlineFunctionGenerators)); |
| 679 return kInlineFunctionGenerators[lookup_index]; |
676 } | 680 } |
677 | 681 |
678 | 682 |
679 void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* node) { | 683 void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* node) { |
680 ZoneList<Expression*>* args = node->arguments(); | 684 ZoneList<Expression*>* args = node->arguments(); |
681 Handle<String> name = node->name(); | 685 Handle<String> name = node->name(); |
682 Runtime::Function* function = node->function(); | 686 Runtime::Function* function = node->function(); |
683 ASSERT(function != NULL); | 687 ASSERT(function != NULL); |
684 ASSERT(function->intrinsic_type == Runtime::INLINE); | 688 ASSERT(function->intrinsic_type == Runtime::INLINE); |
685 InlineFunctionGenerator generator = | 689 InlineFunctionGenerator generator = |
686 FindInlineFunctionGenerator(function->function_id); | 690 FindInlineFunctionGenerator(function->function_id); |
687 ASSERT(generator != NULL); | |
688 ((*this).*(generator))(args); | 691 ((*this).*(generator))(args); |
689 } | 692 } |
690 | 693 |
691 | 694 |
692 void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { | 695 void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { |
693 Comment cmnt(masm_, "[ BinaryOperation"); | 696 Comment cmnt(masm_, "[ BinaryOperation"); |
694 Token::Value op = expr->op(); | 697 Token::Value op = expr->op(); |
695 Expression* left = expr->left(); | 698 Expression* left = expr->left(); |
696 Expression* right = expr->right(); | 699 Expression* right = expr->right(); |
697 | 700 |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 __ Drop(stack_depth); | 1374 __ Drop(stack_depth); |
1372 __ PopTryHandler(); | 1375 __ PopTryHandler(); |
1373 return 0; | 1376 return 0; |
1374 } | 1377 } |
1375 | 1378 |
1376 | 1379 |
1377 #undef __ | 1380 #undef __ |
1378 | 1381 |
1379 | 1382 |
1380 } } // namespace v8::internal | 1383 } } // namespace v8::internal |
OLD | NEW |