Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 15806005: fix the compare nil ic (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 198
199 template <class Stub> 199 template <class Stub>
200 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { 200 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase {
201 public: 201 public:
202 explicit CodeStubGraphBuilder(Stub* stub) 202 explicit CodeStubGraphBuilder(Stub* stub)
203 : CodeStubGraphBuilderBase(Isolate::Current(), stub) {} 203 : CodeStubGraphBuilderBase(Isolate::Current(), stub) {}
204 204
205 protected: 205 protected:
206 virtual HValue* BuildCodeStub() { 206 virtual HValue* BuildCodeStub() {
207 if (casted_stub()->IsMiss()) { 207 if (casted_stub()->IsUninitialized()) {
208 return BuildCodeUninitializedStub();
209 } else {
208 return BuildCodeInitializedStub(); 210 return BuildCodeInitializedStub();
209 } else {
210 return BuildCodeUninitializedStub();
211 } 211 }
212 } 212 }
213 213
214 virtual HValue* BuildCodeInitializedStub() { 214 virtual HValue* BuildCodeInitializedStub() {
215 UNIMPLEMENTED(); 215 UNIMPLEMENTED();
216 return NULL; 216 return NULL;
217 } 217 }
218 218
219 virtual HValue* BuildCodeUninitializedStub() { 219 virtual HValue* BuildCodeUninitializedStub() {
220 // Force a deopt that falls back to the runtime. 220 // Force a deopt that falls back to the runtime.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 template <class Stub> 269 template <class Stub>
270 static Handle<Code> DoGenerateCode(Stub* stub) { 270 static Handle<Code> DoGenerateCode(Stub* stub) {
271 Isolate* isolate = Isolate::Current(); 271 Isolate* isolate = Isolate::Current();
272 CodeStub::Major major_key = 272 CodeStub::Major major_key =
273 static_cast<HydrogenCodeStub*>(stub)->MajorKey(); 273 static_cast<HydrogenCodeStub*>(stub)->MajorKey();
274 CodeStubInterfaceDescriptor* descriptor = 274 CodeStubInterfaceDescriptor* descriptor =
275 isolate->code_stub_interface_descriptor(major_key); 275 isolate->code_stub_interface_descriptor(major_key);
276 if (descriptor->register_param_count_ < 0) { 276 if (descriptor->register_param_count_ < 0) {
277 stub->InitializeInterfaceDescriptor(isolate, descriptor); 277 stub->InitializeInterfaceDescriptor(isolate, descriptor);
278 } 278 }
279 // The miss case without stack parameters can use a light-weight stub to enter 279
280 // If we are uninitialized we can use a light-weight stub to enter
280 // the runtime that is significantly faster than using the standard 281 // the runtime that is significantly faster than using the standard
281 // stub-failure deopt mechanism. 282 // stub-failure deopt mechanism.
282 if (stub->IsMiss() && descriptor->stack_parameter_count_ == NULL) { 283 if (stub->IsUninitialized() && descriptor->has_miss_handler()) {
284 ASSERT(descriptor->stack_parameter_count_ == NULL);
283 return stub->GenerateLightweightMissCode(isolate); 285 return stub->GenerateLightweightMissCode(isolate);
284 } else {
285 CodeStubGraphBuilder<Stub> builder(stub);
286 LChunk* chunk = OptimizeGraph(builder.CreateGraph());
287 return chunk->Codegen();
288 } 286 }
287 CodeStubGraphBuilder<Stub> builder(stub);
288 LChunk* chunk = OptimizeGraph(builder.CreateGraph());
289 return chunk->Codegen();
289 } 290 }
290 291
291 292
292 template <> 293 template <>
293 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { 294 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
294 Zone* zone = this->zone(); 295 Zone* zone = this->zone();
295 Factory* factory = isolate()->factory(); 296 Factory* factory = isolate()->factory();
296 HValue* undefined = graph()->GetConstantUndefined(); 297 HValue* undefined = graph()->GetConstantUndefined();
297 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); 298 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode();
298 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); 299 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode();
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 return new_object; 652 return new_object;
652 } 653 }
653 654
654 655
655 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { 656 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() {
656 return DoGenerateCode(this); 657 return DoGenerateCode(this);
657 } 658 }
658 659
659 660
660 template <> 661 template <>
661 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeUninitializedStub() { 662 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() {
662 CompareNilICStub* stub = casted_stub(); 663 CompareNilICStub* stub = casted_stub();
663 HIfContinuation continuation; 664 HIfContinuation continuation;
664 Handle<Map> sentinel_map(graph()->isolate()->heap()->meta_map()); 665 Handle<Map> sentinel_map(graph()->isolate()->heap()->meta_map());
665 BuildCompareNil(GetParameter(0), stub->GetKind(), 666 BuildCompareNil(GetParameter(0), stub->GetKind(),
666 stub->GetTypes(), sentinel_map, 667 stub->GetTypes(), sentinel_map,
667 RelocInfo::kNoPosition, &continuation); 668 RelocInfo::kNoPosition, &continuation);
668 IfBuilder if_nil(this, &continuation); 669 IfBuilder if_nil(this, &continuation);
669 if_nil.Then(); 670 if_nil.Then();
670 if (continuation.IsFalseReachable()) { 671 if (continuation.IsFalseReachable()) {
671 if_nil.Else(); 672 if_nil.Else();
672 if_nil.Return(graph()->GetConstantSmi0()); 673 if_nil.Return(graph()->GetConstantSmi0());
673 } 674 }
674 if_nil.End(); 675 if_nil.End();
675 return continuation.IsTrueReachable() 676 return continuation.IsTrueReachable()
676 ? graph()->GetConstantSmi1() 677 ? graph()->GetConstantSmi1()
677 : graph()->GetConstantUndefined(); 678 : graph()->GetConstantUndefined();
678 } 679 }
679 680
680 681
681 Handle<Code> CompareNilICStub::GenerateCode() { 682 Handle<Code> CompareNilICStub::GenerateCode() {
682 return DoGenerateCode(this); 683 return DoGenerateCode(this);
683 } 684 }
684 685
685 } } // namespace v8::internal 686 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698