Do not use CodeStub::FindInCache if not necessary.
authoryangguo@chromium.org <yangguo@chromium.org>
Tue, 9 Sep 2014 11:45:53 +0000 (11:45 +0000)
committeryangguo@chromium.org <yangguo@chromium.org>
Tue, 9 Sep 2014 11:45:53 +0000 (11:45 +0000)
GetCode does the FindInCache check as well.

R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/548313002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23795 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/arm/code-stubs-arm.cc
src/code-stubs.cc
src/ia32/code-stubs-ia32.cc

index ff8daf4..f1e8c6d 100644 (file)
@@ -976,20 +976,10 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
 
 
 void CodeStub::GenerateFPStubs(Isolate* isolate) {
+  // Generate if not already in cache.
   SaveFPRegsMode mode = kSaveFPRegs;
-  CEntryStub save_doubles(isolate, 1, mode);
-  StoreBufferOverflowStub stub(isolate, mode);
-  // These stubs might already be in the snapshot, detect that and don't
-  // regenerate, which would lead to code stub initialization state being messed
-  // up.
-  Code* save_doubles_code;
-  if (!save_doubles.FindCodeInCache(&save_doubles_code)) {
-    save_doubles_code = *save_doubles.GetCode();
-  }
-  Code* store_buffer_overflow_code;
-  if (!stub.FindCodeInCache(&store_buffer_overflow_code)) {
-      store_buffer_overflow_code = *stub.GetCode();
-  }
+  CEntryStub(isolate, 1, mode).GetCode();
+  StoreBufferOverflowStub(isolate, mode).GetCode();
   isolate->set_fp_stubs_generated(true);
 }
 
index 0fe4a54..fac530e 100644 (file)
@@ -134,9 +134,8 @@ Handle<Code> PlatformCodeStub::GenerateCode() {
 Handle<Code> CodeStub::GetCode() {
   Heap* heap = isolate()->heap();
   Code* code;
-  if (UseSpecialCache()
-      ? FindCodeInSpecialCache(&code)
-      : FindCodeInCache(&code)) {
+  if (UseSpecialCache() ? FindCodeInSpecialCache(&code)
+                        : FindCodeInCache(&code)) {
     DCHECK(GetCodeKind() == code->kind());
     return Handle<Code>(code);
   }
index 6c9a24c..754ee73 100644 (file)
@@ -2273,13 +2273,8 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
 
 
 void CodeStub::GenerateFPStubs(Isolate* isolate) {
-  CEntryStub save_doubles(isolate, 1, kSaveFPRegs);
-  // Stubs might already be in the snapshot, detect that and don't regenerate,
-  // which would lead to code stub initialization state being messed up.
-  Code* save_doubles_code;
-  if (!save_doubles.FindCodeInCache(&save_doubles_code)) {
-    save_doubles_code = *(save_doubles.GetCode());
-  }
+  // Generate if not already in cache.
+  CEntryStub(isolate, 1, kSaveFPRegs).GetCode();
   isolate->set_fp_stubs_generated(true);
 }