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

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

Issue 1412153002: [fullcode] Make intrinsic-to-stub-call handling platform independent. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment tweaks Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/full-codegen.cc
diff --git a/src/full-codegen/full-codegen.cc b/src/full-codegen/full-codegen.cc
index d7e95fbbec57c3f111202a7c376cfa7a652be3d5..35c074db38ef90d47dd2106a960c37612ac4215a 100644
--- a/src/full-codegen/full-codegen.cc
+++ b/src/full-codegen/full-codegen.cc
@@ -482,6 +482,63 @@ void FullCodeGenerator::EmitMathPow(CallRuntime* expr) {
}
+void FullCodeGenerator::EmitIntrinsicAsStubCall(CallRuntime* expr,
+ const Callable& callable) {
+ ZoneList<Expression*>* args = expr->arguments();
+ int param_count = callable.descriptor().GetRegisterParameterCount();
+ DCHECK_EQ(args->length(), param_count);
+
+ if (param_count > 0) {
+ int last = param_count - 1;
+ // Put all but last arguments on stack.
+ for (int i = 0; i < last; i++) {
+ VisitForStackValue(args->at(i));
+ }
+ // The last argument goes to the accumulator.
+ VisitForAccumulatorValue(args->at(last));
+
+ // Move the arguments to the registers, as required by the stub.
+ __ Move(callable.descriptor().GetRegisterParameter(last),
+ result_register());
+ for (int i = last; i-- > 0;) {
+ __ Pop(callable.descriptor().GetRegisterParameter(i));
+ }
+ }
+ __ Call(callable.code(), RelocInfo::CODE_TARGET);
+ context()->Plug(result_register());
+}
+
+
+void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) {
+ EmitIntrinsicAsStubCall(expr, CodeFactory::NumberToString(isolate()));
+}
+
+
+void FullCodeGenerator::EmitToString(CallRuntime* expr) {
+ EmitIntrinsicAsStubCall(expr, CodeFactory::ToString(isolate()));
+}
+
+
+void FullCodeGenerator::EmitToLength(CallRuntime* expr) {
+ EmitIntrinsicAsStubCall(expr, CodeFactory::ToLength(isolate()));
+}
+
+
+void FullCodeGenerator::EmitToNumber(CallRuntime* expr) {
+ EmitIntrinsicAsStubCall(expr, CodeFactory::ToNumber(isolate()));
+}
+
+
+void FullCodeGenerator::EmitToObject(CallRuntime* expr) {
+ EmitIntrinsicAsStubCall(expr, CodeFactory::ToObject(isolate()));
+}
+
+
+void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) {
+ EmitIntrinsicAsStubCall(expr, CodeFactory::RegExpConstructResult(isolate()));
+}
+
+
bool RecordStatementPosition(MacroAssembler* masm, int pos) {
if (pos == RelocInfo::kNoPosition) return false;
masm->positions_recorder()->RecordStatementPosition(pos);
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698