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

Unified Diff: src/code-stubs-hydrogen.cc

Issue 106313003: Reland "Allocation site support for monomorphic StringAdds in BinaryOps". (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 12 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/code-stubs.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index f66a9e3a27a37834927eb3322f82789c63265e61..374f55f06879ffe12ecf7685f39f450d4eaa98dc 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -911,6 +911,7 @@ HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
(state.HasSideEffects() || !result_type->Is(Type::None())));
HValue* result = NULL;
+ HAllocationMode allocation_mode(NOT_TENURED);
if (state.op() == Token::ADD &&
(left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) &&
!left_type->Is(Type::String()) && !right_type->Is(Type::String())) {
@@ -924,14 +925,15 @@ HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
Push(BuildBinaryOperation(
state.op(), left, right,
handle(Type::String(), isolate()), right_type,
- result_type, state.fixed_right_arg()));
+ result_type, state.fixed_right_arg(),
+ allocation_mode));
}
if_leftisstring.Else();
{
Push(BuildBinaryOperation(
state.op(), left, right,
left_type, right_type, result_type,
- state.fixed_right_arg()));
+ state.fixed_right_arg(), allocation_mode));
}
if_leftisstring.End();
result = Pop();
@@ -943,14 +945,15 @@ HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
Push(BuildBinaryOperation(
state.op(), left, right,
left_type, handle(Type::String(), isolate()),
- result_type, state.fixed_right_arg()));
+ result_type, state.fixed_right_arg(),
+ allocation_mode));
}
if_rightisstring.Else();
{
Push(BuildBinaryOperation(
state.op(), left, right,
left_type, right_type, result_type,
- state.fixed_right_arg()));
+ state.fixed_right_arg(), allocation_mode));
}
if_rightisstring.End();
result = Pop();
@@ -959,7 +962,7 @@ HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
result = BuildBinaryOperation(
state.op(), left, right,
left_type, right_type, result_type,
- state.fixed_right_arg());
+ state.fixed_right_arg(), allocation_mode);
}
// If we encounter a generic argument, the number conversion is
@@ -1007,6 +1010,31 @@ Handle<Code> BinaryOpICStub::GenerateCode(Isolate* isolate) {
template <>
+HValue* CodeStubGraphBuilder<BinaryOpWithAllocationSiteStub>::BuildCodeStub() {
+ BinaryOpIC::State state = casted_stub()->state();
+
+ HValue* allocation_site = GetParameter(
+ BinaryOpWithAllocationSiteStub::kAllocationSite);
+ HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft);
+ HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight);
+
+ Handle<Type> left_type = state.GetLeftType(isolate());
+ Handle<Type> right_type = state.GetRightType(isolate());
+ Handle<Type> result_type = state.GetResultType(isolate());
+ HAllocationMode allocation_mode(allocation_site);
+
+ return BuildBinaryOperation(state.op(), left, right,
+ left_type, right_type, result_type,
+ state.fixed_right_arg(), allocation_mode);
+}
+
+
+Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode(Isolate* isolate) {
+ return DoGenerateCode(isolate, this);
+}
+
+
+template <>
HValue* CodeStubGraphBuilder<NewStringAddStub>::BuildCodeInitializedStub() {
NewStringAddStub* stub = casted_stub();
StringAddFlags flags = stub->flags();
@@ -1023,7 +1051,7 @@ HValue* CodeStubGraphBuilder<NewStringAddStub>::BuildCodeInitializedStub() {
right = BuildCheckString(right);
}
- return BuildStringAdd(left, right, pretenure_flag);
+ return BuildStringAdd(left, right, HAllocationMode(pretenure_flag));
}
« no previous file with comments | « src/code-stubs.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698