| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } else { | 171 } else { |
| 172 ASSERT(descriptor_->environment_length() == param_count); | 172 ASSERT(descriptor_->environment_length() == param_count); |
| 173 stack_parameter_count = graph()->GetConstantMinus1(); | 173 stack_parameter_count = graph()->GetConstantMinus1(); |
| 174 arguments_length_ = graph()->GetConstant0(); | 174 arguments_length_ = graph()->GetConstant0(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 context_ = new(zone) HContext(); | 177 context_ = new(zone) HContext(); |
| 178 AddInstruction(context_); | 178 AddInstruction(context_); |
| 179 start_environment->BindContext(context_); | 179 start_environment->BindContext(context_); |
| 180 | 180 |
| 181 AddSimulate(BailoutId::StubEntry()); | 181 Add<HSimulate>(BailoutId::StubEntry()); |
| 182 | 182 |
| 183 NoObservableSideEffectsScope no_effects(this); | 183 NoObservableSideEffectsScope no_effects(this); |
| 184 | 184 |
| 185 HValue* return_value = BuildCodeStub(); | 185 HValue* return_value = BuildCodeStub(); |
| 186 | 186 |
| 187 // We might have extra expressions to pop from the stack in addition to the | 187 // We might have extra expressions to pop from the stack in addition to the |
| 188 // arguments above. | 188 // arguments above. |
| 189 HInstruction* stack_pop_count = stack_parameter_count; | 189 HInstruction* stack_pop_count = stack_parameter_count; |
| 190 if (descriptor_->function_mode_ == JS_FUNCTION_STUB_MODE) { | 190 if (descriptor_->function_mode_ == JS_FUNCTION_STUB_MODE) { |
| 191 if (!stack_parameter_count->IsConstant() && | 191 if (!stack_parameter_count->IsConstant() && |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } else { | 359 } else { |
| 360 ElementsKind elements_kind = casted_stub()->ComputeElementsKind(); | 360 ElementsKind elements_kind = casted_stub()->ComputeElementsKind(); |
| 361 environment()->Push(BuildCloneShallowArray(context(), | 361 environment()->Push(BuildCloneShallowArray(context(), |
| 362 boilerplate, | 362 boilerplate, |
| 363 allocation_site, | 363 allocation_site, |
| 364 alloc_site_mode, | 364 alloc_site_mode, |
| 365 elements_kind, | 365 elements_kind, |
| 366 length)); | 366 length)); |
| 367 } | 367 } |
| 368 | 368 |
| 369 HValue* result = environment()->Pop(); | |
| 370 checker.ElseDeopt(); | 369 checker.ElseDeopt(); |
| 371 return result; | 370 environment()->Push(undefined); |
| 371 checker.End(); |
| 372 |
| 373 return environment()->Pop(); |
| 372 } | 374 } |
| 373 | 375 |
| 374 | 376 |
| 375 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { | 377 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { |
| 376 return DoGenerateCode(this); | 378 return DoGenerateCode(this); |
| 377 } | 379 } |
| 378 | 380 |
| 379 | 381 |
| 380 template <> | 382 template <> |
| 381 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { | 383 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 409 } | 411 } |
| 410 | 412 |
| 411 HInstruction* object = AddInstruction(new(zone) | 413 HInstruction* object = AddInstruction(new(zone) |
| 412 HAllocate(context(), size_in_bytes, HType::JSObject(), flags)); | 414 HAllocate(context(), size_in_bytes, HType::JSObject(), flags)); |
| 413 | 415 |
| 414 for (int i = 0; i < size; i += kPointerSize) { | 416 for (int i = 0; i < size; i += kPointerSize) { |
| 415 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i); | 417 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i); |
| 416 AddStore(object, access, AddLoad(boilerplate, access)); | 418 AddStore(object, access, AddLoad(boilerplate, access)); |
| 417 } | 419 } |
| 418 | 420 |
| 421 environment()->Push(object); |
| 419 checker.ElseDeopt(); | 422 checker.ElseDeopt(); |
| 420 return object; | 423 environment()->Push(undefined); |
| 424 checker.End(); |
| 425 |
| 426 return environment()->Pop(); |
| 421 } | 427 } |
| 422 | 428 |
| 423 | 429 |
| 424 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { | 430 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { |
| 425 return DoGenerateCode(this); | 431 return DoGenerateCode(this); |
| 426 } | 432 } |
| 427 | 433 |
| 428 | 434 |
| 429 template <> | 435 template <> |
| 430 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { | 436 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 Handle<Object> hole(isolate()->heap()->the_hole_value(), isolate()); | 851 Handle<Object> hole(isolate()->heap()->the_hole_value(), isolate()); |
| 846 Handle<Object> placeholer_value(Smi::FromInt(0), isolate()); | 852 Handle<Object> placeholer_value(Smi::FromInt(0), isolate()); |
| 847 Handle<PropertyCell> placeholder_cell = | 853 Handle<PropertyCell> placeholder_cell = |
| 848 isolate()->factory()->NewPropertyCell(placeholer_value); | 854 isolate()->factory()->NewPropertyCell(placeholer_value); |
| 849 | 855 |
| 850 HParameter* receiver = GetParameter(0); | 856 HParameter* receiver = GetParameter(0); |
| 851 HParameter* value = GetParameter(2); | 857 HParameter* value = GetParameter(2); |
| 852 | 858 |
| 853 if (stub->is_constant()) { | 859 if (stub->is_constant()) { |
| 854 // Assume every store to a constant value changes it. | 860 // Assume every store to a constant value changes it. |
| 855 current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll); | 861 Add<HDeoptimize>(Deoptimizer::EAGER); |
| 856 set_current_block(NULL); | |
| 857 } else { | 862 } else { |
| 858 HValue* cell = Add<HConstant>(placeholder_cell, Representation::Tagged()); | 863 HValue* cell = Add<HConstant>(placeholder_cell, Representation::Tagged()); |
| 859 | 864 |
| 860 // Check that the map of the global has not changed: use a placeholder map | 865 // Check that the map of the global has not changed: use a placeholder map |
| 861 // that will be replaced later with the global object's map. | 866 // that will be replaced later with the global object's map. |
| 862 Handle<Map> placeholder_map = isolate()->factory()->meta_map(); | 867 Handle<Map> placeholder_map = isolate()->factory()->meta_map(); |
| 863 AddInstruction(HCheckMaps::New(receiver, placeholder_map, zone())); | 868 AddInstruction(HCheckMaps::New(receiver, placeholder_map, zone())); |
| 864 | 869 |
| 865 // Load the payload of the global parameter cell. A hole indicates that the | 870 // Load the payload of the global parameter cell. A hole indicates that the |
| 866 // property has been deleted and that the store must be handled by the | 871 // property has been deleted and that the store must be handled by the |
| (...skipping 20 matching lines...) Expand all Loading... |
| 887 | 892 |
| 888 template<> | 893 template<> |
| 889 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { | 894 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { |
| 890 HValue* value = GetParameter(0); | 895 HValue* value = GetParameter(0); |
| 891 HValue* map = GetParameter(1); | 896 HValue* map = GetParameter(1); |
| 892 HValue* key = GetParameter(2); | 897 HValue* key = GetParameter(2); |
| 893 HValue* object = GetParameter(3); | 898 HValue* object = GetParameter(3); |
| 894 | 899 |
| 895 if (FLAG_trace_elements_transitions) { | 900 if (FLAG_trace_elements_transitions) { |
| 896 // Tracing elements transitions is the job of the runtime. | 901 // Tracing elements transitions is the job of the runtime. |
| 897 current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll); | 902 Add<HDeoptimize>(Deoptimizer::EAGER); |
| 898 set_current_block(NULL); | |
| 899 } else { | 903 } else { |
| 900 info()->MarkAsSavesCallerDoubles(); | 904 info()->MarkAsSavesCallerDoubles(); |
| 901 | 905 |
| 902 BuildTransitionElementsKind(object, map, | 906 BuildTransitionElementsKind(object, map, |
| 903 casted_stub()->from_kind(), | 907 casted_stub()->from_kind(), |
| 904 casted_stub()->to_kind(), | 908 casted_stub()->to_kind(), |
| 905 casted_stub()->is_jsarray()); | 909 casted_stub()->is_jsarray()); |
| 906 | 910 |
| 907 BuildUncheckedMonomorphicElementAccess(object, key, value, NULL, | 911 BuildUncheckedMonomorphicElementAccess(object, key, value, NULL, |
| 908 casted_stub()->is_jsarray(), | 912 casted_stub()->is_jsarray(), |
| 909 casted_stub()->to_kind(), | 913 casted_stub()->to_kind(), |
| 910 true, ALLOW_RETURN_HOLE, | 914 true, ALLOW_RETURN_HOLE, |
| 911 casted_stub()->store_mode()); | 915 casted_stub()->store_mode()); |
| 912 } | 916 } |
| 913 | 917 |
| 914 return value; | 918 return value; |
| 915 } | 919 } |
| 916 | 920 |
| 917 | 921 |
| 918 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { | 922 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { |
| 919 return DoGenerateCode(this); | 923 return DoGenerateCode(this); |
| 920 } | 924 } |
| 921 | 925 |
| 922 | 926 |
| 923 } } // namespace v8::internal | 927 } } // namespace v8::internal |
| OLD | NEW |