| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 CompilationInfo* info() { return &info_; } | 79 CompilationInfo* info() { return &info_; } |
| 80 HydrogenCodeStub* stub() { return info_.code_stub(); } | 80 HydrogenCodeStub* stub() { return info_.code_stub(); } |
| 81 HContext* context() { return context_; } | 81 HContext* context() { return context_; } |
| 82 Isolate* isolate() { return info_.isolate(); } | 82 Isolate* isolate() { return info_.isolate(); } |
| 83 | 83 |
| 84 class ArrayContextChecker { | 84 class ArrayContextChecker { |
| 85 public: | 85 public: |
| 86 ArrayContextChecker(HGraphBuilder* builder, HValue* constructor, | 86 ArrayContextChecker(HGraphBuilder* builder, HValue* constructor, |
| 87 HValue* array_function) | 87 HValue* array_function) |
| 88 : checker_(builder) { | 88 : checker_(builder) { |
| 89 checker_.If<HCompareObjectEqAndBranch, HValue*>(constructor, | 89 checker_.If<HCompareObjectAndBranch, HValue*>(constructor, |
| 90 array_function); | 90 array_function); |
| 91 checker_.Then(); | 91 checker_.Then(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 ~ArrayContextChecker() { | 94 ~ArrayContextChecker() { |
| 95 checker_.ElseDeopt(); | 95 checker_.ElseDeopt(); |
| 96 checker_.End(); | 96 checker_.End(); |
| 97 } | 97 } |
| 98 private: | 98 private: |
| 99 IfBuilder checker_; | 99 IfBuilder checker_; |
| 100 }; | 100 }; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 virtual HValue* BuildCodeInitializedStub() { | 230 virtual HValue* BuildCodeInitializedStub() { |
| 231 UNIMPLEMENTED(); | 231 UNIMPLEMENTED(); |
| 232 return NULL; | 232 return NULL; |
| 233 } | 233 } |
| 234 | 234 |
| 235 virtual HValue* BuildCodeUninitializedStub() { | 235 virtual HValue* BuildCodeUninitializedStub() { |
| 236 // Force a deopt that falls back to the runtime. | 236 // Force a deopt that falls back to the runtime. |
| 237 HValue* undefined = graph()->GetConstantUndefined(); | 237 HValue* undefined = graph()->GetConstantUndefined(); |
| 238 IfBuilder builder(this); | 238 IfBuilder builder(this); |
| 239 builder.IfNot<HCompareObjectEqAndBranch, HValue*>(undefined, undefined); | 239 builder.IfNot<HCompareObjectAndBranch, HValue*>(undefined, undefined); |
| 240 builder.Then(); | 240 builder.Then(); |
| 241 builder.ElseDeopt(); | 241 builder.ElseDeopt(); |
| 242 return undefined; | 242 return undefined; |
| 243 } | 243 } |
| 244 | 244 |
| 245 Stub* casted_stub() { return static_cast<Stub*>(stub()); } | 245 Stub* casted_stub() { return static_cast<Stub*>(stub()); } |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 | 248 |
| 249 Handle<Code> HydrogenCodeStub::GenerateLightweightMissCode(Isolate* isolate) { | 249 Handle<Code> HydrogenCodeStub::GenerateLightweightMissCode(Isolate* isolate) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); | 345 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); |
| 346 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); | 346 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); |
| 347 int length = casted_stub()->length(); | 347 int length = casted_stub()->length(); |
| 348 | 348 |
| 349 HInstruction* allocation_site = | 349 HInstruction* allocation_site = |
| 350 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), | 350 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), |
| 351 GetParameter(1), | 351 GetParameter(1), |
| 352 NULL, | 352 NULL, |
| 353 FAST_ELEMENTS)); | 353 FAST_ELEMENTS)); |
| 354 IfBuilder checker(this); | 354 IfBuilder checker(this); |
| 355 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, undefined); | 355 checker.IfNot<HCompareObjectAndBranch, HValue*>(allocation_site, undefined); |
| 356 checker.Then(); | 356 checker.Then(); |
| 357 | 357 |
| 358 HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo(); | 358 HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo(); |
| 359 HInstruction* boilerplate = AddLoad(allocation_site, access); | 359 HInstruction* boilerplate = AddLoad(allocation_site, access); |
| 360 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { | 360 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { |
| 361 HValue* elements = AddLoadElements(boilerplate); | 361 HValue* elements = AddLoadElements(boilerplate); |
| 362 | 362 |
| 363 IfBuilder if_fixed_cow(this); | 363 IfBuilder if_fixed_cow(this); |
| 364 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map()); | 364 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map()); |
| 365 if_fixed_cow.Then(); | 365 if_fixed_cow.Then(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 Zone* zone = this->zone(); | 414 Zone* zone = this->zone(); |
| 415 HValue* undefined = graph()->GetConstantUndefined(); | 415 HValue* undefined = graph()->GetConstantUndefined(); |
| 416 | 416 |
| 417 HInstruction* boilerplate = | 417 HInstruction* boilerplate = |
| 418 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), | 418 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), |
| 419 GetParameter(1), | 419 GetParameter(1), |
| 420 NULL, | 420 NULL, |
| 421 FAST_ELEMENTS)); | 421 FAST_ELEMENTS)); |
| 422 | 422 |
| 423 IfBuilder checker(this); | 423 IfBuilder checker(this); |
| 424 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(boilerplate, undefined); | 424 checker.IfNot<HCompareObjectAndBranch, HValue*>(boilerplate, undefined); |
| 425 checker.And(); | 425 checker.And(); |
| 426 | 426 |
| 427 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; | 427 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
| 428 HValue* boilerplate_size = | 428 HValue* boilerplate_size = |
| 429 AddInstruction(new(zone) HInstanceSize(boilerplate)); | 429 AddInstruction(new(zone) HInstanceSize(boilerplate)); |
| 430 HValue* size_in_words = | 430 HValue* size_in_words = |
| 431 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2)); | 431 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2)); |
| 432 checker.If<HCompareNumericAndBranch>(boilerplate_size, | 432 checker.If<HCompareNumericAndBranch>(boilerplate_size, |
| 433 size_in_words, Token::EQ); | 433 size_in_words, Token::EQ); |
| 434 checker.Then(); | 434 checker.Then(); |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 Handle<Map> placeholder_map = isolate()->factory()->meta_map(); | 890 Handle<Map> placeholder_map = isolate()->factory()->meta_map(); |
| 891 AddInstruction(HCheckMaps::New( | 891 AddInstruction(HCheckMaps::New( |
| 892 receiver, placeholder_map, zone(), top_info())); | 892 receiver, placeholder_map, zone(), top_info())); |
| 893 | 893 |
| 894 HValue* cell = Add<HConstant>(placeholder_cell, Representation::Tagged()); | 894 HValue* cell = Add<HConstant>(placeholder_cell, Representation::Tagged()); |
| 895 HObjectAccess access(HObjectAccess::ForCellPayload(isolate())); | 895 HObjectAccess access(HObjectAccess::ForCellPayload(isolate())); |
| 896 HValue* cell_contents = Add<HLoadNamedField>(cell, access); | 896 HValue* cell_contents = Add<HLoadNamedField>(cell, access); |
| 897 | 897 |
| 898 if (stub->is_constant()) { | 898 if (stub->is_constant()) { |
| 899 IfBuilder builder(this); | 899 IfBuilder builder(this); |
| 900 builder.If<HCompareObjectEqAndBranch>(cell_contents, value); | 900 builder.If<HCompareObjectAndBranch>(cell_contents, value); |
| 901 builder.Then(); | 901 builder.Then(); |
| 902 builder.ElseDeopt(); | 902 builder.ElseDeopt(); |
| 903 builder.End(); | 903 builder.End(); |
| 904 } else { | 904 } else { |
| 905 // Load the payload of the global parameter cell. A hole indicates that the | 905 // Load the payload of the global parameter cell. A hole indicates that the |
| 906 // property has been deleted and that the store must be handled by the | 906 // property has been deleted and that the store must be handled by the |
| 907 // runtime. | 907 // runtime. |
| 908 IfBuilder builder(this); | 908 IfBuilder builder(this); |
| 909 HValue* hole_value = Add<HConstant>(hole, Representation::Tagged()); | 909 HValue* hole_value = Add<HConstant>(hole, Representation::Tagged()); |
| 910 builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value); | 910 builder.If<HCompareObjectAndBranch>(cell_contents, hole_value); |
| 911 builder.Then(); | 911 builder.Then(); |
| 912 builder.Deopt(); | 912 builder.Deopt(); |
| 913 builder.Else(); | 913 builder.Else(); |
| 914 Add<HStoreNamedField>(cell, access, value); | 914 Add<HStoreNamedField>(cell, access, value); |
| 915 builder.End(); | 915 builder.End(); |
| 916 } | 916 } |
| 917 | 917 |
| 918 return value; | 918 return value; |
| 919 } | 919 } |
| 920 | 920 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 return value; | 952 return value; |
| 953 } | 953 } |
| 954 | 954 |
| 955 | 955 |
| 956 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { | 956 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { |
| 957 return DoGenerateCode(this); | 957 return DoGenerateCode(this); |
| 958 } | 958 } |
| 959 | 959 |
| 960 | 960 |
| 961 } } // namespace v8::internal | 961 } } // namespace v8::internal |
| OLD | NEW |