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 97543002: Refactor BinaryOpIC to be able to use different stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years 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/ia32/code-stubs-ia32.cc » ('j') | src/log.cc » ('J')
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 03b8c18fbdae004a0c550fe0c515aa979569c397..56c2b84d9e5e273032c30705c2465e541c4996c0 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -894,20 +894,21 @@ Handle<Code> CompareNilICStub::GenerateCode(Isolate* isolate) {
template <>
-HValue* CodeStubGraphBuilder<BinaryOpStub>::BuildCodeInitializedStub() {
- BinaryOpStub* stub = casted_stub();
- HValue* left = GetParameter(0);
- HValue* right = GetParameter(1);
+HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
+ BinaryOpIC::State state = casted_stub()->state();
- Handle<Type> left_type = stub->GetLeftType(isolate());
- Handle<Type> right_type = stub->GetRightType(isolate());
- Handle<Type> result_type = stub->GetResultType(isolate());
+ HValue* left = GetParameter(BinaryOpICStub::kLeft);
+ HValue* right = GetParameter(BinaryOpICStub::kRight);
+
+ Handle<Type> left_type = state.GetLeftType(isolate());
+ Handle<Type> right_type = state.GetRightType(isolate());
+ Handle<Type> result_type = state.GetResultType(isolate());
ASSERT(!left_type->Is(Type::None()) && !right_type->Is(Type::None()) &&
- (stub->HasSideEffects(isolate()) || !result_type->Is(Type::None())));
+ (state.HasSideEffects() || !result_type->Is(Type::None())));
HValue* result = NULL;
- if (stub->operation() == Token::ADD &&
+ 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())) {
// For the generic add stub a fast case for string addition is performance
@@ -918,16 +919,16 @@ HValue* CodeStubGraphBuilder<BinaryOpStub>::BuildCodeInitializedStub() {
if_leftisstring.Then();
{
Push(BuildBinaryOperation(
- stub->operation(), left, right,
+ state.op(), left, right,
handle(Type::String(), isolate()), right_type,
- result_type, stub->fixed_right_arg()));
+ result_type, state.fixed_right_arg()));
}
if_leftisstring.Else();
{
Push(BuildBinaryOperation(
- stub->operation(), left, right,
+ state.op(), left, right,
left_type, right_type, result_type,
- stub->fixed_right_arg()));
+ state.fixed_right_arg()));
}
if_leftisstring.End();
result = Pop();
@@ -937,32 +938,32 @@ HValue* CodeStubGraphBuilder<BinaryOpStub>::BuildCodeInitializedStub() {
if_rightisstring.Then();
{
Push(BuildBinaryOperation(
- stub->operation(), left, right,
+ state.op(), left, right,
left_type, handle(Type::String(), isolate()),
- result_type, stub->fixed_right_arg()));
+ result_type, state.fixed_right_arg()));
}
if_rightisstring.Else();
{
Push(BuildBinaryOperation(
- stub->operation(), left, right,
+ state.op(), left, right,
left_type, right_type, result_type,
- stub->fixed_right_arg()));
+ state.fixed_right_arg()));
}
if_rightisstring.End();
result = Pop();
}
} else {
result = BuildBinaryOperation(
- stub->operation(), left, right,
+ state.op(), left, right,
left_type, right_type, result_type,
- stub->fixed_right_arg());
+ state.fixed_right_arg());
}
// If we encounter a generic argument, the number conversion is
// observable, thus we cannot afford to bail out after the fact.
- if (!stub->HasSideEffects(isolate())) {
+ if (!state.HasSideEffects()) {
if (result_type->Is(Type::Smi())) {
- if (stub->operation() == Token::SHR) {
+ if (state.op() == Token::SHR) {
// TODO(olivf) Replace this by a SmiTagU Instruction.
// 0x40000000: this number would convert to negative when interpreting
// the register as signed value;
@@ -980,8 +981,8 @@ HValue* CodeStubGraphBuilder<BinaryOpStub>::BuildCodeInitializedStub() {
// Reuse the double box of one of the operands if we are allowed to (i.e.
// chained binops).
- if (stub->CanReuseDoubleBox()) {
- HValue* operand = (stub->mode() == OVERWRITE_LEFT) ? left : right;
+ if (state.CanReuseDoubleBox()) {
+ HValue* operand = (state.mode() == OVERWRITE_LEFT) ? left : right;
IfBuilder if_heap_number(this);
if_heap_number.IfNot<HIsSmiAndBranch>(operand);
if_heap_number.Then();
@@ -997,7 +998,7 @@ HValue* CodeStubGraphBuilder<BinaryOpStub>::BuildCodeInitializedStub() {
}
-Handle<Code> BinaryOpStub::GenerateCode(Isolate* isolate) {
+Handle<Code> BinaryOpICStub::GenerateCode(Isolate* isolate) {
return DoGenerateCode(isolate, this);
}
« no previous file with comments | « src/code-stubs.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | src/log.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698