Revision: 18668
Author: [email protected]
Date: Fri Jan 17 14:08:50 2014 UTC
Log: Moving logic to AstNode to determine how many type cells are
required.
With this change, we'll be able to discover how many type cells we
need at parse time, enabling future optimizations.
[email protected]
Review URL: https://codereview.chromium.org/141533004
http://code.google.com/p/v8/source/detail?r=18668
Modified:
/branches/bleeding_edge/src/arm/full-codegen-arm.cc
/branches/bleeding_edge/src/ast.cc
/branches/bleeding_edge/src/ast.h
/branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
/branches/bleeding_edge/src/mips/full-codegen-mips.cc
/branches/bleeding_edge/src/x64/full-codegen-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Wed Jan 15 09:05:21
2014 UTC
+++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Fri Jan 17 14:08:50
2014 UTC
@@ -2721,10 +2721,9 @@
Comment cmnt(masm_, "[ Call");
Expression* callee = expr->expression();
- VariableProxy* proxy = callee->AsVariableProxy();
- Property* property = callee->AsProperty();
+ Call::CallType call_type = expr->GetCallType(isolate());
- if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) {
+ if (call_type == Call::POSSIBLY_EVAL_CALL) {
// In a call to eval, we first call %ResolvePossiblyDirectEval to
// resolve the function we need to call and the receiver of the
// call. Then we call the resolved function using the given
@@ -2763,13 +2762,15 @@
// Restore context register.
__ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
context()->DropAndPlug(1, r0);
- } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
+ } else if (call_type == Call::GLOBAL_CALL) {
// Push global object as receiver for the call IC.
__ ldr(r0, GlobalObjectOperand());
__ push(r0);
+ VariableProxy* proxy = callee->AsVariableProxy();
EmitCallWithIC(expr, proxy->name(), CONTEXTUAL);
- } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
+ } else if (call_type == Call::LOOKUP_SLOT_CALL) {
// Call to a lookup slot (dynamically introduced variable).
+ VariableProxy* proxy = callee->AsVariableProxy();
Label slow, done;
{ PreservePositionScope scope(masm()->positions_recorder());
@@ -2806,7 +2807,8 @@
// The receiver is either the global receiver or an object found
// by LoadContextSlot.
EmitCallWithStub(expr);
- } else if (property != NULL) {
+ } else if (call_type == Call::PROPERTY_CALL) {
+ Property* property = callee->AsProperty();
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(property->obj());
}
@@ -2818,6 +2820,7 @@
EmitKeyedCallWithIC(expr, property->key());
}
} else {
+ ASSERT(call_type == Call::OTHER_CALL);
// Call to an arbitrary expression not handled specially above.
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(callee);
=======================================
--- /branches/bleeding_edge/src/ast.cc Tue Jan 14 16:15:05 2014 UTC
+++ /branches/bleeding_edge/src/ast.cc Fri Jan 17 14:08:50 2014 UTC
@@ -590,10 +590,26 @@
// TODO(rossberg): all RecordTypeFeedback functions should disappear
// once we use the common type field in the AST consistently.
-
void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
to_boolean_types_ = oracle->ToBooleanTypes(test_id());
}
+
+
+Call::CallType Call::GetCallType(Isolate* isolate) const {
+ VariableProxy* proxy = expression()->AsVariableProxy();
+ if (proxy != NULL) {
+ if (proxy->var()->is_possibly_eval(isolate)) {
+ return POSSIBLY_EVAL_CALL;
+ } else if (proxy->var()->IsUnallocated()) {
+ return GLOBAL_CALL;
+ } else if (proxy->var()->IsLookupSlot()) {
+ return LOOKUP_SLOT_CALL;
+ }
+ }
+
+ Property* property = expression()->AsProperty();
+ return property != NULL ? PROPERTY_CALL : OTHER_CALL;
+}
bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) {
=======================================
--- /branches/bleeding_edge/src/ast.h Tue Jan 14 16:15:05 2014 UTC
+++ /branches/bleeding_edge/src/ast.h Fri Jan 17 14:08:50 2014 UTC
@@ -1774,6 +1774,17 @@
BailoutId ReturnId() const { return return_id_; }
+ enum CallType {
+ POSSIBLY_EVAL_CALL,
+ GLOBAL_CALL,
+ LOOKUP_SLOT_CALL,
+ PROPERTY_CALL,
+ OTHER_CALL
+ };
+
+ // Helpers to determine how to handle the call.
+ CallType GetCallType(Isolate* isolate) const;
+
// TODO(rossberg): this should really move somewhere else (and be merged
with
// various similar methods in objets.cc), but for now...
static Handle<JSObject> GetPrototypeForPrimitiveCheck(
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Wed Jan 15
09:05:21 2014 UTC
+++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Fri Jan 17
14:08:50 2014 UTC
@@ -2673,10 +2673,9 @@
Comment cmnt(masm_, "[ Call");
Expression* callee = expr->expression();
- VariableProxy* proxy = callee->AsVariableProxy();
- Property* property = callee->AsProperty();
+ Call::CallType call_type = expr->GetCallType(isolate());
- if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) {
+ if (call_type == Call::POSSIBLY_EVAL_CALL) {
// In a call to eval, we first call %ResolvePossiblyDirectEval to
// resolve the function we need to call and the receiver of the call.
// Then we call the resolved function using the given arguments.
@@ -2711,12 +2710,14 @@
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
context()->DropAndPlug(1, eax);
- } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
+ } else if (call_type == Call::GLOBAL_CALL) {
// Push global object as receiver for the call IC.
__ push(GlobalObjectOperand());
+ VariableProxy* proxy = callee->AsVariableProxy();
EmitCallWithIC(expr, proxy->name(), CONTEXTUAL);
- } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
+ } else if (call_type == Call::LOOKUP_SLOT_CALL) {
// Call to a lookup slot (dynamically introduced variable).
+ VariableProxy* proxy = callee->AsVariableProxy();
Label slow, done;
{ PreservePositionScope scope(masm()->positions_recorder());
// Generate code for loading from variables potentially shadowed by
@@ -2750,7 +2751,8 @@
// LoadContextSlot.
EmitCallWithStub(expr);
- } else if (property != NULL) {
+ } else if (call_type == Call::PROPERTY_CALL) {
+ Property* property = callee->AsProperty();
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(property->obj());
}
@@ -2763,6 +2765,7 @@
}
} else {
+ ASSERT(call_type == Call::OTHER_CALL);
// Call to an arbitrary expression not handled specially above.
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(callee);
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Wed Jan 15
09:05:21 2014 UTC
+++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Fri Jan 17
14:08:50 2014 UTC
@@ -2755,10 +2755,9 @@
Comment cmnt(masm_, "[ Call");
Expression* callee = expr->expression();
- VariableProxy* proxy = callee->AsVariableProxy();
- Property* property = callee->AsProperty();
+ Call::CallType call_type = expr->GetCallType(isolate());
- if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) {
+ if (call_type == Call::POSSIBLY_EVAL_CALL) {
// In a call to eval, we first call %ResolvePossiblyDirectEval to
// resolve the function we need to call and the receiver of the
// call. Then we call the resolved function using the given
@@ -2796,13 +2795,15 @@
// Restore context register.
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
context()->DropAndPlug(1, v0);
- } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
+ } else if (call_type == Call::GLOBAL_CALL) {
// Push global object as receiver for the call IC.
__ lw(a0, GlobalObjectOperand());
__ push(a0);
+ VariableProxy* proxy = callee->AsVariableProxy();
EmitCallWithIC(expr, proxy->name(), CONTEXTUAL);
- } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
+ } else if (call_type == Call::LOOKUP_SLOT_CALL) {
// Call to a lookup slot (dynamically introduced variable).
+ VariableProxy* proxy = callee->AsVariableProxy();
Label slow, done;
{ PreservePositionScope scope(masm()->positions_recorder());
@@ -2839,7 +2840,8 @@
// The receiver is either the global receiver or an object found
// by LoadContextSlot.
EmitCallWithStub(expr);
- } else if (property != NULL) {
+ } else if (call_type == Call::PROPERTY_CALL) {
+ Property* property = callee->AsProperty();
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(property->obj());
}
@@ -2851,6 +2853,7 @@
EmitKeyedCallWithIC(expr, property->key());
}
} else {
+ ASSERT(call_type == Call::OTHER_CALL);
// Call to an arbitrary expression not handled specially above.
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(callee);
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Wed Jan 15 09:05:21
2014 UTC
+++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Fri Jan 17 14:08:50
2014 UTC
@@ -2658,10 +2658,9 @@
Comment cmnt(masm_, "[ Call");
Expression* callee = expr->expression();
- VariableProxy* proxy = callee->AsVariableProxy();
- Property* property = callee->AsProperty();
+ Call::CallType call_type = expr->GetCallType(isolate());
- if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) {
+ if (call_type == Call::POSSIBLY_EVAL_CALL) {
// In a call to eval, we first call %ResolvePossiblyDirectEval to
// resolve the function we need to call and the receiver of the call.
// Then we call the resolved function using the given arguments.
@@ -2695,13 +2694,15 @@
// Restore context register.
__ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
context()->DropAndPlug(1, rax);
- } else if (proxy != NULL && proxy->var()->IsUnallocated()) {
+ } else if (call_type == Call::GLOBAL_CALL) {
// Call to a global variable. Push global object as receiver for the
// call IC lookup.
__ push(GlobalObjectOperand());
+ VariableProxy* proxy = callee->AsVariableProxy();
EmitCallWithIC(expr, proxy->name(), CONTEXTUAL);
- } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
+ } else if (call_type == Call::LOOKUP_SLOT_CALL) {
// Call to a lookup slot (dynamically introduced variable).
+ VariableProxy* proxy = callee->AsVariableProxy();
Label slow, done;
{ PreservePositionScope scope(masm()->positions_recorder());
@@ -2735,7 +2736,8 @@
// The receiver is either the global receiver or an object found by
// LoadContextSlot.
EmitCallWithStub(expr);
- } else if (property != NULL) {
+ } else if (call_type == Call::PROPERTY_CALL) {
+ Property* property = callee->AsProperty();
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(property->obj());
}
@@ -2747,6 +2749,7 @@
EmitKeyedCallWithIC(expr, property->key());
}
} else {
+ ASSERT(call_type == Call::OTHER_CALL);
// Call to an arbitrary expression not handled specially above.
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(callee);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.