Chromium Code Reviews

Unified Diff: src/x64/full-codegen-x64.cc

Issue 1191283003: [date] Use explicit control flow to replace %_ThrowIfNotADate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/runtime/runtime-date.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/full-codegen-x64.cc
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
index beed6f26b8141d95194dab75e06d249cce3cd66d..859efecd6ee6d6aae3be31511c9478e4d31a4a09 100644
--- a/src/x64/full-codegen-x64.cc
+++ b/src/x64/full-codegen-x64.cc
@@ -3789,25 +3789,25 @@ void FullCodeGenerator::EmitValueOf(CallRuntime* expr) {
}
-void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) {
+void FullCodeGenerator::EmitIsDate(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK_EQ(1, args->length());
- VisitForAccumulatorValue(args->at(0)); // Load the object.
+ VisitForAccumulatorValue(args->at(0));
- Register object = rax;
- Register result = rax;
- Register scratch = rcx;
+ Label materialize_true, materialize_false;
+ Label* if_true = nullptr;
+ Label* if_false = nullptr;
+ Label* fall_through = nullptr;
+ context()->PrepareTest(&materialize_true, &materialize_false, &if_true,
+ &if_false, &fall_through);
- Label done, not_date_object;
- __ JumpIfSmi(object, &not_date_object, Label::kNear);
- __ CmpObjectType(object, JS_DATE_TYPE, scratch);
- __ j(equal, &done, Label::kNear);
- __ bind(&not_date_object);
- __ CallRuntime(Runtime::kThrowNotDateError, 0);
+ __ JumpIfSmi(rax, if_false);
+ __ CmpObjectType(rax, JS_DATE_TYPE, rbx);
+ PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
+ Split(equal, if_true, if_false, fall_through);
- __ bind(&done);
- context()->Plug(result);
+ context()->Plug(if_true, if_false);
}
« no previous file with comments | « src/runtime/runtime-date.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine