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 checker.End(); |
371 | |
372 return environment()->Pop(); | |
372 } | 373 } |
373 | 374 |
374 | 375 |
375 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { | 376 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { |
376 return DoGenerateCode(this); | 377 return DoGenerateCode(this); |
377 } | 378 } |
378 | 379 |
379 | 380 |
380 template <> | 381 template <> |
381 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { | 382 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { |
(...skipping 27 matching lines...) Expand all Loading... | |
409 } | 410 } |
410 | 411 |
411 HInstruction* object = AddInstruction(new(zone) | 412 HInstruction* object = AddInstruction(new(zone) |
412 HAllocate(context(), size_in_bytes, HType::JSObject(), flags)); | 413 HAllocate(context(), size_in_bytes, HType::JSObject(), flags)); |
413 | 414 |
414 for (int i = 0; i < size; i += kPointerSize) { | 415 for (int i = 0; i < size; i += kPointerSize) { |
415 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i); | 416 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i); |
416 AddStore(object, access, AddLoad(boilerplate, access)); | 417 AddStore(object, access, AddLoad(boilerplate, access)); |
417 } | 418 } |
418 | 419 |
420 environment()->Push(object); | |
Jakob Kummerow
2013/07/22 16:53:12
I don't understand why this Push/Pop sequence is n
danno
2013/07/23 12:18:14
Sort of. The problem is that there was no real mer
| |
419 checker.ElseDeopt(); | 421 checker.ElseDeopt(); |
420 return object; | 422 checker.End(); |
423 | |
424 return environment()->Pop(); | |
421 } | 425 } |
422 | 426 |
423 | 427 |
424 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { | 428 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { |
425 return DoGenerateCode(this); | 429 return DoGenerateCode(this); |
426 } | 430 } |
427 | 431 |
428 | 432 |
429 template <> | 433 template <> |
430 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { | 434 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()); | 849 Handle<Object> hole(isolate()->heap()->the_hole_value(), isolate()); |
846 Handle<Object> placeholer_value(Smi::FromInt(0), isolate()); | 850 Handle<Object> placeholer_value(Smi::FromInt(0), isolate()); |
847 Handle<PropertyCell> placeholder_cell = | 851 Handle<PropertyCell> placeholder_cell = |
848 isolate()->factory()->NewPropertyCell(placeholer_value); | 852 isolate()->factory()->NewPropertyCell(placeholer_value); |
849 | 853 |
850 HParameter* receiver = GetParameter(0); | 854 HParameter* receiver = GetParameter(0); |
851 HParameter* value = GetParameter(2); | 855 HParameter* value = GetParameter(2); |
852 | 856 |
853 if (stub->is_constant()) { | 857 if (stub->is_constant()) { |
854 // Assume every store to a constant value changes it. | 858 // Assume every store to a constant value changes it. |
855 current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll); | 859 Add<HDeoptimize>(Deoptimizer::EAGER); |
856 set_current_block(NULL); | |
857 } else { | 860 } else { |
858 HValue* cell = Add<HConstant>(placeholder_cell, Representation::Tagged()); | 861 HValue* cell = Add<HConstant>(placeholder_cell, Representation::Tagged()); |
859 | 862 |
860 // Check that the map of the global has not changed: use a placeholder map | 863 // 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. | 864 // that will be replaced later with the global object's map. |
862 Handle<Map> placeholder_map = isolate()->factory()->meta_map(); | 865 Handle<Map> placeholder_map = isolate()->factory()->meta_map(); |
863 AddInstruction(HCheckMaps::New(receiver, placeholder_map, zone())); | 866 AddInstruction(HCheckMaps::New(receiver, placeholder_map, zone())); |
864 | 867 |
865 // Load the payload of the global parameter cell. A hole indicates that the | 868 // 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 | 869 // property has been deleted and that the store must be handled by the |
(...skipping 20 matching lines...) Expand all Loading... | |
887 | 890 |
888 template<> | 891 template<> |
889 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { | 892 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { |
890 HValue* value = GetParameter(0); | 893 HValue* value = GetParameter(0); |
891 HValue* map = GetParameter(1); | 894 HValue* map = GetParameter(1); |
892 HValue* key = GetParameter(2); | 895 HValue* key = GetParameter(2); |
893 HValue* object = GetParameter(3); | 896 HValue* object = GetParameter(3); |
894 | 897 |
895 if (FLAG_trace_elements_transitions) { | 898 if (FLAG_trace_elements_transitions) { |
896 // Tracing elements transitions is the job of the runtime. | 899 // Tracing elements transitions is the job of the runtime. |
897 current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll); | 900 Add<HDeoptimize>(Deoptimizer::EAGER); |
898 set_current_block(NULL); | |
899 } else { | 901 } else { |
900 info()->MarkAsSavesCallerDoubles(); | 902 info()->MarkAsSavesCallerDoubles(); |
901 | 903 |
902 BuildTransitionElementsKind(object, map, | 904 BuildTransitionElementsKind(object, map, |
903 casted_stub()->from_kind(), | 905 casted_stub()->from_kind(), |
904 casted_stub()->to_kind(), | 906 casted_stub()->to_kind(), |
905 casted_stub()->is_jsarray()); | 907 casted_stub()->is_jsarray()); |
906 | 908 |
907 BuildUncheckedMonomorphicElementAccess(object, key, value, NULL, | 909 BuildUncheckedMonomorphicElementAccess(object, key, value, NULL, |
908 casted_stub()->is_jsarray(), | 910 casted_stub()->is_jsarray(), |
909 casted_stub()->to_kind(), | 911 casted_stub()->to_kind(), |
910 true, ALLOW_RETURN_HOLE, | 912 true, ALLOW_RETURN_HOLE, |
911 casted_stub()->store_mode()); | 913 casted_stub()->store_mode()); |
912 } | 914 } |
913 | 915 |
914 return value; | 916 return value; |
915 } | 917 } |
916 | 918 |
917 | 919 |
918 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { | 920 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { |
919 return DoGenerateCode(this); | 921 return DoGenerateCode(this); |
920 } | 922 } |
921 | 923 |
922 | 924 |
923 } } // namespace v8::internal | 925 } } // namespace v8::internal |
OLD | NEW |