Reviewers: ulan, Rodolph Perfetta,

Message:
Next one... PTAL
-- Benedikt

Description:
[arm] Avoid useless branch in stack check.

Please review this at https://codereview.chromium.org/101833004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+15, -15 lines):
  src/arm/full-codegen-arm.cc
  src/arm/lithium-codegen-arm.h
  src/arm/lithium-codegen-arm.cc


Index: src/arm/full-codegen-arm.cc
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
index f6d3ea36ab8ce6e0ce21759ce369e8be34db2666..5eb97b00f964f74474497a08478aa9abefc24db8 100644
--- a/src/arm/full-codegen-arm.cc
+++ b/src/arm/full-codegen-arm.cc
@@ -293,10 +293,9 @@ void FullCodeGenerator::Generate() {
       Label ok;
       __ LoadRoot(ip, Heap::kStackLimitRootIndex);
       __ cmp(sp, Operand(ip));
-      __ b(hs, &ok);
PredictableCodeSizeScope predictable(masm_, 2 * Assembler::kInstrSize);
-      __ Call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET);
-      __ bind(&ok);
+      __ Call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET,
+              TypeFeedbackId::None(), lo);
     }

     { Comment cmnt(masm_, "[ Body");
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index 8f1c9c090dfbdf6e1de38ed34c1f028a2efbe8b0..df66177a9992e59aa16a29971ce966a33644b6f6 100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -699,8 +699,10 @@ void LCodeGen::AddToTranslation(LEnvironment* environment,
 void LCodeGen::CallCode(Handle<Code> code,
                         RelocInfo::Mode mode,
                         LInstruction* instr,
-                        TargetAddressStorageMode storage_mode) {
- CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT, storage_mode);
+                        TargetAddressStorageMode storage_mode,
+                        Condition cond) {
+  CallCodeGeneric(code, mode, instr, RECORD_SIMPLE_SAFEPOINT, storage_mode,
+                  cond);
 }


@@ -708,13 +710,14 @@ void LCodeGen::CallCodeGeneric(Handle<Code> code,
                                RelocInfo::Mode mode,
                                LInstruction* instr,
                                SafepointMode safepoint_mode,
-                               TargetAddressStorageMode storage_mode) {
+                               TargetAddressStorageMode storage_mode,
+                               Condition cond) {
   EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
   ASSERT(instr != NULL);
// Block literal pool emission to ensure nop indicating no inlined smi code
   // is in the correct position.
   Assembler::BlockConstPoolScope block_const_pool(masm());
-  __ Call(code, mode, TypeFeedbackId::None(), al, storage_mode);
+  __ Call(code, mode, TypeFeedbackId::None(), cond, storage_mode);
   RecordSafepointWithLazyDeopt(instr, safepoint_mode);

   // Signal that we don't inline smi code before these stubs in the
@@ -5684,19 +5687,15 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) {
   // prepare for lazy deoptimization explicitly here.
   if (instr->hydrogen()->is_function_entry()) {
     // Perform stack overflow check.
-    Label done;
     __ LoadRoot(ip, Heap::kStackLimitRootIndex);
     __ cmp(sp, Operand(ip));
-    __ b(hs, &done);
     PredictableCodeSizeScope predictable(masm_, 2 * Assembler::kInstrSize);
     ASSERT(instr->context()->IsRegister());
     ASSERT(ToRegister(instr->context()).is(cp));
-    CallCode(isolate()->builtins()->StackCheck(),
-              RelocInfo::CODE_TARGET,
-              instr);
+ CallCode(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET, instr,
+             CAN_INLINE_TARGET_ADDRESS, lo);
     EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
     last_lazy_deopt_pc_ = masm()->pc_offset();
-    __ bind(&done);
     RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
     safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
   } else {
Index: src/arm/lithium-codegen-arm.h
diff --git a/src/arm/lithium-codegen-arm.h b/src/arm/lithium-codegen-arm.h
index 8d9be3ac3d1f209e9c587453f4e8c3cc9567eb29..3fa3eedff508a524736251e711723646a0df3c2f 100644
--- a/src/arm/lithium-codegen-arm.h
+++ b/src/arm/lithium-codegen-arm.h
@@ -208,14 +208,16 @@ class LCodeGen: public LCodeGenBase {
       Handle<Code> code,
       RelocInfo::Mode mode,
       LInstruction* instr,
-      TargetAddressStorageMode storage_mode = CAN_INLINE_TARGET_ADDRESS);
+      TargetAddressStorageMode storage_mode = CAN_INLINE_TARGET_ADDRESS,
+      Condition cond = al);

   void CallCodeGeneric(
       Handle<Code> code,
       RelocInfo::Mode mode,
       LInstruction* instr,
       SafepointMode safepoint_mode,
-      TargetAddressStorageMode storage_mode = CAN_INLINE_TARGET_ADDRESS);
+      TargetAddressStorageMode storage_mode = CAN_INLINE_TARGET_ADDRESS,
+      Condition cond = al);

   void CallRuntime(const Runtime::Function* function,
                    int num_arguments,


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to