OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5933 AddInstruction(new(zone()) HCheckNonSmi(object)); | 5933 AddInstruction(new(zone()) HCheckNonSmi(object)); |
5934 SmallMapList* maps = prop->GetReceiverTypes(); | 5934 SmallMapList* maps = prop->GetReceiverTypes(); |
5935 bool todo_external_array = false; | 5935 bool todo_external_array = false; |
5936 | 5936 |
5937 if (!is_store) { | 5937 if (!is_store) { |
5938 HInstruction* consolidated_load = | 5938 HInstruction* consolidated_load = |
5939 TryBuildConsolidatedElementLoad(object, key, val, maps); | 5939 TryBuildConsolidatedElementLoad(object, key, val, maps); |
5940 if (consolidated_load != NULL) { | 5940 if (consolidated_load != NULL) { |
5941 AddInstruction(consolidated_load); | 5941 AddInstruction(consolidated_load); |
5942 *has_side_effects |= consolidated_load->HasObservableSideEffects(); | 5942 *has_side_effects |= consolidated_load->HasObservableSideEffects(); |
5943 consolidated_load->set_position(position); | 5943 if (position != RelocInfo::kNoPosition) { |
| 5944 consolidated_load->set_position(position); |
| 5945 } |
5944 return consolidated_load; | 5946 return consolidated_load; |
5945 } | 5947 } |
5946 } | 5948 } |
5947 | 5949 |
5948 static const int kNumElementTypes = kElementsKindCount; | 5950 static const int kNumElementTypes = kElementsKindCount; |
5949 bool type_todo[kNumElementTypes]; | 5951 bool type_todo[kNumElementTypes]; |
5950 for (int i = 0; i < kNumElementTypes; ++i) { | 5952 for (int i = 0; i < kNumElementTypes; ++i) { |
5951 type_todo[i] = false; | 5953 type_todo[i] = false; |
5952 } | 5954 } |
5953 | 5955 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5999 if (num_untransitionable_maps == 1) { | 6001 if (num_untransitionable_maps == 1) { |
6000 HInstruction* instr = NULL; | 6002 HInstruction* instr = NULL; |
6001 if (untransitionable_map->has_slow_elements_kind()) { | 6003 if (untransitionable_map->has_slow_elements_kind()) { |
6002 instr = AddInstruction(is_store ? BuildStoreKeyedGeneric(object, key, val) | 6004 instr = AddInstruction(is_store ? BuildStoreKeyedGeneric(object, key, val) |
6003 : BuildLoadKeyedGeneric(object, key)); | 6005 : BuildLoadKeyedGeneric(object, key)); |
6004 } else { | 6006 } else { |
6005 instr = AddInstruction(BuildMonomorphicElementAccess( | 6007 instr = AddInstruction(BuildMonomorphicElementAccess( |
6006 object, key, val, transition, untransitionable_map, is_store)); | 6008 object, key, val, transition, untransitionable_map, is_store)); |
6007 } | 6009 } |
6008 *has_side_effects |= instr->HasObservableSideEffects(); | 6010 *has_side_effects |= instr->HasObservableSideEffects(); |
6009 instr->set_position(position); | 6011 if (position != RelocInfo::kNoPosition) instr->set_position(position); |
6010 return is_store ? NULL : instr; | 6012 return is_store ? NULL : instr; |
6011 } | 6013 } |
6012 | 6014 |
6013 AddInstruction(HCheckInstanceType::NewIsSpecObject(object, zone())); | 6015 AddInstruction(HCheckInstanceType::NewIsSpecObject(object, zone())); |
6014 HBasicBlock* join = graph()->CreateBasicBlock(); | 6016 HBasicBlock* join = graph()->CreateBasicBlock(); |
6015 | 6017 |
6016 HInstruction* elements_kind_instr = | 6018 HInstruction* elements_kind_instr = |
6017 AddInstruction(new(zone()) HElementsKind(object)); | 6019 AddInstruction(new(zone()) HElementsKind(object)); |
6018 HCompareConstantEqAndBranch* elements_kind_branch = NULL; | 6020 HCompareConstantEqAndBranch* elements_kind_branch = NULL; |
6019 HInstruction* elements = AddInstruction(new(zone()) HLoadElements(object)); | 6021 HInstruction* elements = AddInstruction(new(zone()) HLoadElements(object)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6101 if (is_store) { | 6103 if (is_store) { |
6102 access = AddInstruction(BuildStoreKeyedGeneric(object, key, val)); | 6104 access = AddInstruction(BuildStoreKeyedGeneric(object, key, val)); |
6103 } else { | 6105 } else { |
6104 access = AddInstruction(BuildLoadKeyedGeneric(object, key)); | 6106 access = AddInstruction(BuildLoadKeyedGeneric(object, key)); |
6105 } | 6107 } |
6106 } else { // External array elements. | 6108 } else { // External array elements. |
6107 access = AddInstruction(BuildExternalArrayElementAccess( | 6109 access = AddInstruction(BuildExternalArrayElementAccess( |
6108 external_elements, checked_key, val, elements_kind, is_store)); | 6110 external_elements, checked_key, val, elements_kind, is_store)); |
6109 } | 6111 } |
6110 *has_side_effects |= access->HasObservableSideEffects(); | 6112 *has_side_effects |= access->HasObservableSideEffects(); |
6111 access->set_position(position); | 6113 if (position != RelocInfo::kNoPosition) access->set_position(position); |
6112 if (!is_store) { | 6114 if (!is_store) { |
6113 Push(access); | 6115 Push(access); |
6114 } | 6116 } |
6115 current_block()->Goto(join); | 6117 current_block()->Goto(join); |
6116 set_current_block(if_false); | 6118 set_current_block(if_false); |
6117 } | 6119 } |
6118 } | 6120 } |
6119 | 6121 |
6120 // Deopt if none of the cases matched. | 6122 // Deopt if none of the cases matched. |
6121 current_block()->FinishExitWithDeoptimization(HDeoptimize::kNoUses); | 6123 current_block()->FinishExitWithDeoptimization(HDeoptimize::kNoUses); |
(...skipping 26 matching lines...) Expand all Loading... |
6148 !expr->GetReceiverTypes()->is_empty()) { | 6150 !expr->GetReceiverTypes()->is_empty()) { |
6149 return HandlePolymorphicElementAccess( | 6151 return HandlePolymorphicElementAccess( |
6150 obj, key, val, expr, ast_id, position, is_store, has_side_effects); | 6152 obj, key, val, expr, ast_id, position, is_store, has_side_effects); |
6151 } else { | 6153 } else { |
6152 if (is_store) { | 6154 if (is_store) { |
6153 instr = BuildStoreKeyedGeneric(obj, key, val); | 6155 instr = BuildStoreKeyedGeneric(obj, key, val); |
6154 } else { | 6156 } else { |
6155 instr = BuildLoadKeyedGeneric(obj, key); | 6157 instr = BuildLoadKeyedGeneric(obj, key); |
6156 } | 6158 } |
6157 } | 6159 } |
6158 instr->set_position(position); | 6160 if (position != RelocInfo::kNoPosition) instr->set_position(position); |
6159 AddInstruction(instr); | 6161 AddInstruction(instr); |
6160 *has_side_effects = instr->HasObservableSideEffects(); | 6162 *has_side_effects = instr->HasObservableSideEffects(); |
6161 return instr; | 6163 return instr; |
6162 } | 6164 } |
6163 | 6165 |
6164 | 6166 |
6165 HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object, | 6167 HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object, |
6166 HValue* key, | 6168 HValue* key, |
6167 HValue* value) { | 6169 HValue* value) { |
6168 HValue* context = environment()->LookupContext(); | 6170 HValue* context = environment()->LookupContext(); |
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7500 (this->*generator)(expr); | 7502 (this->*generator)(expr); |
7501 } else { | 7503 } else { |
7502 ASSERT(function->intrinsic_type == Runtime::RUNTIME); | 7504 ASSERT(function->intrinsic_type == Runtime::RUNTIME); |
7503 CHECK_ALIVE(VisitArgumentList(expr->arguments())); | 7505 CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
7504 | 7506 |
7505 HValue* context = environment()->LookupContext(); | 7507 HValue* context = environment()->LookupContext(); |
7506 Handle<String> name = expr->name(); | 7508 Handle<String> name = expr->name(); |
7507 int argument_count = expr->arguments()->length(); | 7509 int argument_count = expr->arguments()->length(); |
7508 HCallRuntime* call = | 7510 HCallRuntime* call = |
7509 new(zone()) HCallRuntime(context, name, function, argument_count); | 7511 new(zone()) HCallRuntime(context, name, function, argument_count); |
7510 call->set_position(RelocInfo::kNoPosition); | |
7511 Drop(argument_count); | 7512 Drop(argument_count); |
7512 return ast_context()->ReturnInstruction(call, expr->id()); | 7513 return ast_context()->ReturnInstruction(call, expr->id()); |
7513 } | 7514 } |
7514 } | 7515 } |
7515 | 7516 |
7516 | 7517 |
7517 void HGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) { | 7518 void HGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) { |
7518 ASSERT(!HasStackOverflow()); | 7519 ASSERT(!HasStackOverflow()); |
7519 ASSERT(current_block() != NULL); | 7520 ASSERT(current_block() != NULL); |
7520 ASSERT(current_block()->HasPredecessor()); | 7521 ASSERT(current_block()->HasPredecessor()); |
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9575 } | 9576 } |
9576 } | 9577 } |
9577 | 9578 |
9578 #ifdef DEBUG | 9579 #ifdef DEBUG |
9579 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9580 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9580 if (allocator_ != NULL) allocator_->Verify(); | 9581 if (allocator_ != NULL) allocator_->Verify(); |
9581 #endif | 9582 #endif |
9582 } | 9583 } |
9583 | 9584 |
9584 } } // namespace v8::internal | 9585 } } // namespace v8::internal |
OLD | NEW |