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

Unified Diff: src/interpreter/interpreter-intrinsics.cc

Issue 2051573002: [Interpreter] Add intrinsics called as stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix leak Created 4 years, 6 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/interpreter/interpreter-intrinsics.h ('k') | test/cctest/interpreter/test-interpreter-intrinsics.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter-intrinsics.cc
diff --git a/src/interpreter/interpreter-intrinsics.cc b/src/interpreter/interpreter-intrinsics.cc
index bf1f7d3e4691e85d4c892d7ed759579042f7e728..5d8da2004695ab45c27232dd14ef7313cf3d5969 100644
--- a/src/interpreter/interpreter-intrinsics.cc
+++ b/src/interpreter/interpreter-intrinsics.cc
@@ -4,6 +4,8 @@
#include "src/interpreter/interpreter-intrinsics.h"
+#include "src/code-factory.h"
+
namespace v8 {
namespace internal {
namespace interpreter {
@@ -13,7 +15,9 @@ using compiler::Node;
#define __ assembler_->
IntrinsicsHelper::IntrinsicsHelper(InterpreterAssembler* assembler)
- : assembler_(assembler) {}
+ : isolate_(assembler->isolate()),
+ zone_(assembler->zone()),
+ assembler_(assembler) {}
// static
bool IntrinsicsHelper::IsSupported(Runtime::FunctionId function_id) {
@@ -227,6 +231,80 @@ Node* IntrinsicsHelper::IsSmi(Node* input, Node* arg_count, Node* context) {
return return_value.value();
}
+Node* IntrinsicsHelper::IntrinsicAsStubCall(Node* args_reg, Node* context,
+ Callable const& callable) {
+ int param_count = callable.descriptor().GetParameterCount();
+ Node** args = zone()->NewArray<Node*>(param_count + 1); // 1 for context
+ for (int i = 0; i < param_count; i++) {
+ args[i] = __ LoadRegister(args_reg);
+ args_reg = __ NextRegister(args_reg);
+ }
+ args[param_count] = context;
+
+ return __ CallStubN(callable, args);
+}
+
+Node* IntrinsicsHelper::HasProperty(Node* input, Node* arg_count,
+ Node* context) {
+ return IntrinsicAsStubCall(input, context,
+ CodeFactory::HasProperty(isolate()));
+}
+
+Node* IntrinsicsHelper::MathPow(Node* input, Node* arg_count, Node* context) {
+ return IntrinsicAsStubCall(input, context, CodeFactory::MathPow(isolate()));
+}
+
+Node* IntrinsicsHelper::NewObject(Node* input, Node* arg_count, Node* context) {
+ return IntrinsicAsStubCall(input, context,
+ CodeFactory::FastNewObject(isolate()));
+}
+
+Node* IntrinsicsHelper::NumberToString(Node* input, Node* arg_count,
+ Node* context) {
+ return IntrinsicAsStubCall(input, context,
+ CodeFactory::NumberToString(isolate()));
+}
+
+Node* IntrinsicsHelper::RegExpConstructResult(Node* input, Node* arg_count,
+ Node* context) {
+ return IntrinsicAsStubCall(input, context,
+ CodeFactory::RegExpConstructResult(isolate()));
+}
+
+Node* IntrinsicsHelper::RegExpExec(Node* input, Node* arg_count,
+ Node* context) {
+ return IntrinsicAsStubCall(input, context,
+ CodeFactory::RegExpExec(isolate()));
+}
+
+Node* IntrinsicsHelper::SubString(Node* input, Node* arg_count, Node* context) {
+ return IntrinsicAsStubCall(input, context, CodeFactory::SubString(isolate()));
+}
+
+Node* IntrinsicsHelper::ToString(Node* input, Node* arg_count, Node* context) {
+ return IntrinsicAsStubCall(input, context, CodeFactory::ToString(isolate()));
+}
+
+Node* IntrinsicsHelper::ToName(Node* input, Node* arg_count, Node* context) {
+ return IntrinsicAsStubCall(input, context, CodeFactory::ToName(isolate()));
+}
+
+Node* IntrinsicsHelper::ToLength(Node* input, Node* arg_count, Node* context) {
+ return IntrinsicAsStubCall(input, context, CodeFactory::ToLength(isolate()));
+}
+
+Node* IntrinsicsHelper::ToInteger(Node* input, Node* arg_count, Node* context) {
+ return IntrinsicAsStubCall(input, context, CodeFactory::ToInteger(isolate()));
+}
+
+Node* IntrinsicsHelper::ToNumber(Node* input, Node* arg_count, Node* context) {
+ return IntrinsicAsStubCall(input, context, CodeFactory::ToNumber(isolate()));
+}
+
+Node* IntrinsicsHelper::ToObject(Node* input, Node* arg_count, Node* context) {
+ return IntrinsicAsStubCall(input, context, CodeFactory::ToObject(isolate()));
+}
+
Node* IntrinsicsHelper::Call(Node* args_reg, Node* arg_count, Node* context) {
// First argument register contains the function target.
Node* function = __ LoadRegister(args_reg);
« no previous file with comments | « src/interpreter/interpreter-intrinsics.h ('k') | test/cctest/interpreter/test-interpreter-intrinsics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698