X87: Implement inline %_IsJSProxy() for full codegen and Hydrogen.
authorweiliang.lin@intel.com <weiliang.lin@intel.com>
Thu, 16 Oct 2014 06:24:47 +0000 (06:24 +0000)
committerweiliang.lin@intel.com <weiliang.lin@intel.com>
Thu, 16 Oct 2014 06:24:47 +0000 (06:24 +0000)
port r24636.

original commit message:

  Implement inline %_IsJSProxy() for full codegen and Hydrogen
  Saving a runtime call for many builtin functions.

BUG=
R=weiliang.lin@intel.com

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

Patch from Chunyang Dai <chunyang.dai@intel.com>.

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

src/x87/full-codegen-x87.cc

index 0e9d0bb..0c4ddb8 100644 (file)
@@ -3325,6 +3325,31 @@ void FullCodeGenerator::EmitIsRegExp(CallRuntime* expr) {
 }
 
 
+void FullCodeGenerator::EmitIsJSProxy(CallRuntime* expr) {
+  ZoneList<Expression*>* args = expr->arguments();
+  DCHECK(args->length() == 1);
+
+  VisitForAccumulatorValue(args->at(0));
+
+  Label materialize_true, materialize_false;
+  Label* if_true = NULL;
+  Label* if_false = NULL;
+  Label* fall_through = NULL;
+  context()->PrepareTest(&materialize_true, &materialize_false, &if_true,
+                         &if_false, &fall_through);
+
+  __ JumpIfSmi(eax, if_false);
+  Register map = ebx;
+  __ mov(map, FieldOperand(eax, HeapObject::kMapOffset));
+  __ CmpInstanceType(map, FIRST_JS_PROXY_TYPE);
+  __ j(less, if_false);
+  __ CmpInstanceType(map, LAST_JS_PROXY_TYPE);
+  PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
+  Split(less_equal, if_true, if_false, fall_through);
+
+  context()->Plug(if_true, if_false);
+}
+
 
 void FullCodeGenerator::EmitIsConstructCall(CallRuntime* expr) {
   DCHECK(expr->arguments()->length() == 0);