| 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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 HType::JSArray(), flags)); | 977 HType::JSArray(), flags)); |
| 978 Isolate* isolate = graph()->isolate(); | 978 Isolate* isolate = graph()->isolate(); |
| 979 | 979 |
| 980 Factory* factory = isolate->factory(); | 980 Factory* factory = isolate->factory(); |
| 981 Handle<Map> map = IsFastDoubleElementsKind(kind) | 981 Handle<Map> map = IsFastDoubleElementsKind(kind) |
| 982 ? factory->fixed_double_array_map() | 982 ? factory->fixed_double_array_map() |
| 983 : factory->fixed_array_map(); | 983 : factory->fixed_array_map(); |
| 984 BuildStoreMap(elements, map, BailoutId::StubEntry()); | 984 BuildStoreMap(elements, map, BailoutId::StubEntry()); |
| 985 | 985 |
| 986 Handle<String> fixed_array_length_field_name = | 986 Handle<String> fixed_array_length_field_name = |
| 987 isolate->factory()->length_field_symbol(); | 987 isolate->factory()->length_field_string(); |
| 988 HInstruction* store_length = | 988 HInstruction* store_length = |
| 989 new(zone) HStoreNamedField(elements, fixed_array_length_field_name, | 989 new(zone) HStoreNamedField(elements, fixed_array_length_field_name, |
| 990 capacity, true, FixedArray::kLengthOffset); | 990 capacity, true, FixedArray::kLengthOffset); |
| 991 AddInstruction(store_length); | 991 AddInstruction(store_length); |
| 992 AddSimulate(BailoutId::StubEntry(), FIXED_SIMULATE); | 992 AddSimulate(BailoutId::StubEntry(), FIXED_SIMULATE); |
| 993 | 993 |
| 994 return elements; | 994 return elements; |
| 995 } | 995 } |
| 996 | 996 |
| 997 | 997 |
| 998 HInstruction* HGraphBuilder::BuildStoreMap(HValue* object, | 998 HInstruction* HGraphBuilder::BuildStoreMap(HValue* object, |
| 999 HValue* map, | 999 HValue* map, |
| 1000 BailoutId id) { | 1000 BailoutId id) { |
| 1001 Zone* zone = this->zone(); | 1001 Zone* zone = this->zone(); |
| 1002 Isolate* isolate = graph()->isolate(); | 1002 Isolate* isolate = graph()->isolate(); |
| 1003 Factory* factory = isolate->factory(); | 1003 Factory* factory = isolate->factory(); |
| 1004 Handle<String> map_field_name = factory->map_field_symbol(); | 1004 Handle<String> map_field_name = factory->map_field_string(); |
| 1005 HInstruction* store_map = | 1005 HInstruction* store_map = |
| 1006 new(zone) HStoreNamedField(object, map_field_name, map, | 1006 new(zone) HStoreNamedField(object, map_field_name, map, |
| 1007 true, JSObject::kMapOffset); | 1007 true, JSObject::kMapOffset); |
| 1008 store_map->SetGVNFlag(kChangesMaps); | 1008 store_map->SetGVNFlag(kChangesMaps); |
| 1009 AddInstruction(store_map); | 1009 AddInstruction(store_map); |
| 1010 AddSimulate(id, FIXED_SIMULATE); | 1010 AddSimulate(id, FIXED_SIMULATE); |
| 1011 return store_map; | 1011 return store_map; |
| 1012 } | 1012 } |
| 1013 | 1013 |
| 1014 | 1014 |
| (...skipping 4607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5622 if (property->IsCompileTimeValue()) continue; | 5622 if (property->IsCompileTimeValue()) continue; |
| 5623 | 5623 |
| 5624 Literal* key = property->key(); | 5624 Literal* key = property->key(); |
| 5625 Expression* value = property->value(); | 5625 Expression* value = property->value(); |
| 5626 | 5626 |
| 5627 switch (property->kind()) { | 5627 switch (property->kind()) { |
| 5628 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 5628 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
| 5629 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); | 5629 ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); |
| 5630 // Fall through. | 5630 // Fall through. |
| 5631 case ObjectLiteral::Property::COMPUTED: | 5631 case ObjectLiteral::Property::COMPUTED: |
| 5632 if (key->handle()->IsSymbol()) { | 5632 if (key->handle()->IsInternalizedString()) { |
| 5633 if (property->emit_store()) { | 5633 if (property->emit_store()) { |
| 5634 property->RecordTypeFeedback(oracle()); | 5634 property->RecordTypeFeedback(oracle()); |
| 5635 CHECK_ALIVE(VisitForValue(value)); | 5635 CHECK_ALIVE(VisitForValue(value)); |
| 5636 HValue* value = Pop(); | 5636 HValue* value = Pop(); |
| 5637 Handle<Map> map = property->GetReceiverType(); | 5637 Handle<Map> map = property->GetReceiverType(); |
| 5638 Handle<String> name = property->key()->AsPropertyName(); | 5638 Handle<String> name = property->key()->AsPropertyName(); |
| 5639 HInstruction* store; | 5639 HInstruction* store; |
| 5640 if (map.is_null()) { | 5640 if (map.is_null()) { |
| 5641 // If we don't know the monomorphic type, do a generic store. | 5641 // If we don't know the monomorphic type, do a generic store. |
| 5642 CHECK_ALIVE(store = BuildStoreNamedGeneric(literal, name, value)); | 5642 CHECK_ALIVE(store = BuildStoreNamedGeneric(literal, name, value)); |
| (...skipping 3612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9255 AddInstruction(HCheckInstanceType::NewIsSpecObject(right, zone())); | 9255 AddInstruction(HCheckInstanceType::NewIsSpecObject(right, zone())); |
| 9256 HCompareObjectEqAndBranch* result = | 9256 HCompareObjectEqAndBranch* result = |
| 9257 new(zone()) HCompareObjectEqAndBranch(left, right); | 9257 new(zone()) HCompareObjectEqAndBranch(left, right); |
| 9258 result->set_position(expr->position()); | 9258 result->set_position(expr->position()); |
| 9259 return ast_context()->ReturnControl(result, expr->id()); | 9259 return ast_context()->ReturnControl(result, expr->id()); |
| 9260 } | 9260 } |
| 9261 } | 9261 } |
| 9262 default: | 9262 default: |
| 9263 return Bailout("Unsupported non-primitive compare"); | 9263 return Bailout("Unsupported non-primitive compare"); |
| 9264 } | 9264 } |
| 9265 } else if (overall_type_info.IsSymbol() && Token::IsEqualityOp(op)) { | 9265 } else if (overall_type_info.IsInternalizedString() && |
| 9266 Token::IsEqualityOp(op)) { |
| 9266 AddInstruction(new(zone()) HCheckNonSmi(left)); | 9267 AddInstruction(new(zone()) HCheckNonSmi(left)); |
| 9267 AddInstruction(HCheckInstanceType::NewIsSymbol(left, zone())); | 9268 AddInstruction(HCheckInstanceType::NewIsInternalizedString(left, zone())); |
| 9268 AddInstruction(new(zone()) HCheckNonSmi(right)); | 9269 AddInstruction(new(zone()) HCheckNonSmi(right)); |
| 9269 AddInstruction(HCheckInstanceType::NewIsSymbol(right, zone())); | 9270 AddInstruction(HCheckInstanceType::NewIsInternalizedString(right, zone())); |
| 9270 HCompareObjectEqAndBranch* result = | 9271 HCompareObjectEqAndBranch* result = |
| 9271 new(zone()) HCompareObjectEqAndBranch(left, right); | 9272 new(zone()) HCompareObjectEqAndBranch(left, right); |
| 9272 result->set_position(expr->position()); | 9273 result->set_position(expr->position()); |
| 9273 return ast_context()->ReturnControl(result, expr->id()); | 9274 return ast_context()->ReturnControl(result, expr->id()); |
| 9274 } else { | 9275 } else { |
| 9275 if (combined_rep.IsTagged() || combined_rep.IsNone()) { | 9276 if (combined_rep.IsTagged() || combined_rep.IsNone()) { |
| 9276 HCompareGeneric* result = | 9277 HCompareGeneric* result = |
| 9277 new(zone()) HCompareGeneric(context, left, right, op); | 9278 new(zone()) HCompareGeneric(context, left, right, op); |
| 9278 result->set_observed_input_representation(left_rep, right_rep); | 9279 result->set_observed_input_representation(left_rep, right_rep); |
| 9279 result->set_position(expr->position()); | 9280 result->set_position(expr->position()); |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9690 new(zone()) HHasInstanceTypeAndBranch(object, JS_VALUE_TYPE); | 9691 new(zone()) HHasInstanceTypeAndBranch(object, JS_VALUE_TYPE); |
| 9691 HBasicBlock* if_js_value = graph()->CreateBasicBlock(); | 9692 HBasicBlock* if_js_value = graph()->CreateBasicBlock(); |
| 9692 HBasicBlock* not_js_value = graph()->CreateBasicBlock(); | 9693 HBasicBlock* not_js_value = graph()->CreateBasicBlock(); |
| 9693 typecheck->SetSuccessorAt(0, if_js_value); | 9694 typecheck->SetSuccessorAt(0, if_js_value); |
| 9694 typecheck->SetSuccessorAt(1, not_js_value); | 9695 typecheck->SetSuccessorAt(1, not_js_value); |
| 9695 current_block()->Finish(typecheck); | 9696 current_block()->Finish(typecheck); |
| 9696 not_js_value->Goto(join); | 9697 not_js_value->Goto(join); |
| 9697 | 9698 |
| 9698 // Create in-object property store to kValueOffset. | 9699 // Create in-object property store to kValueOffset. |
| 9699 set_current_block(if_js_value); | 9700 set_current_block(if_js_value); |
| 9700 Handle<String> name = isolate()->factory()->undefined_symbol(); | 9701 Handle<String> name = isolate()->factory()->undefined_string(); |
| 9701 AddInstruction(new(zone()) HStoreNamedField(object, | 9702 AddInstruction(new(zone()) HStoreNamedField(object, |
| 9702 name, | 9703 name, |
| 9703 value, | 9704 value, |
| 9704 true, // in-object store. | 9705 true, // in-object store. |
| 9705 JSValue::kValueOffset)); | 9706 JSValue::kValueOffset)); |
| 9706 if_js_value->Goto(join); | 9707 if_js_value->Goto(join); |
| 9707 join->SetJoinId(call->id()); | 9708 join->SetJoinId(call->id()); |
| 9708 set_current_block(join); | 9709 set_current_block(join); |
| 9709 return ast_context()->ReturnValue(value); | 9710 return ast_context()->ReturnValue(value); |
| 9710 } | 9711 } |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10622 } | 10623 } |
| 10623 } | 10624 } |
| 10624 | 10625 |
| 10625 #ifdef DEBUG | 10626 #ifdef DEBUG |
| 10626 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10627 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 10627 if (allocator_ != NULL) allocator_->Verify(); | 10628 if (allocator_ != NULL) allocator_->Verify(); |
| 10628 #endif | 10629 #endif |
| 10629 } | 10630 } |
| 10630 | 10631 |
| 10631 } } // namespace v8::internal | 10632 } } // namespace v8::internal |
| OLD | NEW |