| Index: src/full-codegen.h
|
| ===================================================================
|
| --- src/full-codegen.h (revision 4643)
|
| +++ src/full-codegen.h (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2009 the V8 project authors. All rights reserved.
|
| +// Copyright 2010 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -31,6 +31,7 @@
|
| #include "v8.h"
|
|
|
| #include "ast.h"
|
| +#include "compiler.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
| @@ -229,8 +230,6 @@
|
| return stack_depth + kForInStackElementCount;
|
| }
|
| private:
|
| - // TODO(lrn): Check that this value is correct when implementing
|
| - // for-in.
|
| static const int kForInStackElementCount = 5;
|
| DISALLOW_COPY_AND_ASSIGN(ForIn);
|
| };
|
| @@ -258,12 +257,22 @@
|
| // context.
|
| void DropAndApply(int count, Expression::Context context, Register reg);
|
|
|
| + // Set up branch labels for a test expression.
|
| + void PrepareTest(Label* materialize_true,
|
| + Label* materialize_false,
|
| + Label** if_true,
|
| + Label** if_false);
|
| +
|
| // Emit code to convert pure control flow to a pair of labels into the
|
| // result expected according to an expression context.
|
| void Apply(Expression::Context context,
|
| Label* materialize_true,
|
| Label* materialize_false);
|
|
|
| + // Emit code to convert constant control flow (true or false) into
|
| + // the result expected according to an expression context.
|
| + void Apply(Expression::Context context, bool flag);
|
| +
|
| // Helper function to convert a pure value into a test context. The value
|
| // is expected on the stack or the accumulator, depending on the platform.
|
| // See the platform-specific implementation for details.
|
| @@ -348,6 +357,12 @@
|
| void VisitDeclarations(ZoneList<Declaration*>* declarations);
|
| void DeclareGlobals(Handle<FixedArray> pairs);
|
|
|
| + // Platform-specific code for a variable, constant, or function
|
| + // declaration. Functions have an initial value.
|
| + void EmitDeclaration(Variable* variable,
|
| + Variable::Mode mode,
|
| + FunctionLiteral* function);
|
| +
|
| // Platform-specific return sequence
|
| void EmitReturnSequence(int position);
|
|
|
| @@ -355,9 +370,48 @@
|
| void EmitCallWithStub(Call* expr);
|
| void EmitCallWithIC(Call* expr, Handle<Object> name, RelocInfo::Mode mode);
|
|
|
| +
|
| + // Platform-specific code for inline runtime calls.
|
| + void EmitInlineRuntimeCall(CallRuntime* expr);
|
| + void EmitIsSmi(ZoneList<Expression*>* arguments);
|
| + void EmitIsNonNegativeSmi(ZoneList<Expression*>* arguments);
|
| + void EmitIsObject(ZoneList<Expression*>* arguments);
|
| + void EmitIsUndetectableObject(ZoneList<Expression*>* arguments);
|
| + void EmitIsFunction(ZoneList<Expression*>* arguments);
|
| + void EmitIsArray(ZoneList<Expression*>* arguments);
|
| + void EmitIsRegExp(ZoneList<Expression*>* arguments);
|
| + void EmitIsConstructCall(ZoneList<Expression*>* arguments);
|
| + void EmitObjectEquals(ZoneList<Expression*>* arguments);
|
| + void EmitArguments(ZoneList<Expression*>* arguments);
|
| + void EmitArgumentsLength(ZoneList<Expression*>* arguments);
|
| + void EmitClassOf(ZoneList<Expression*>* arguments);
|
| + void EmitValueOf(ZoneList<Expression*>* arguments);
|
| + void EmitSetValueOf(ZoneList<Expression*>* arguments);
|
| + void EmitNumberToString(ZoneList<Expression*>* arguments);
|
| + void EmitCharFromCode(ZoneList<Expression*>* arguments);
|
| + void EmitFastCharCodeAt(ZoneList<Expression*>* arguments);
|
| + void EmitStringCompare(ZoneList<Expression*>* arguments);
|
| + void EmitStringAdd(ZoneList<Expression*>* arguments);
|
| + void EmitLog(ZoneList<Expression*>* arguments);
|
| + void EmitRandomHeapNumber(ZoneList<Expression*>* arguments);
|
| + void EmitSubString(ZoneList<Expression*>* arguments);
|
| + void EmitRegExpExec(ZoneList<Expression*>* arguments);
|
| + void EmitMathPow(ZoneList<Expression*>* arguments);
|
| + void EmitMathSin(ZoneList<Expression*>* arguments);
|
| + void EmitMathCos(ZoneList<Expression*>* arguments);
|
| + void EmitMathSqrt(ZoneList<Expression*>* arguments);
|
| + void EmitCallFunction(ZoneList<Expression*>* arguments);
|
| + void EmitRegExpConstructResult(ZoneList<Expression*>* arguments);
|
| + void EmitSwapElements(ZoneList<Expression*>* arguments);
|
| + void EmitGetFromCache(ZoneList<Expression*>* arguments);
|
| +
|
| // Platform-specific code for loading variables.
|
| void EmitVariableLoad(Variable* expr, Expression::Context context);
|
|
|
| + // Platform-specific support for allocating a new closure based on
|
| + // the given function info.
|
| + void EmitNewClosure(Handle<SharedFunctionInfo> info);
|
| +
|
| // Platform-specific support for compiling assignments.
|
|
|
| // Load a value from a named property.
|
| @@ -372,9 +426,15 @@
|
| // of the stack and the right one in the accumulator.
|
| void EmitBinaryOp(Token::Value op, Expression::Context context);
|
|
|
| + // Assign to the given expression as if via '='. The right-hand-side value
|
| + // is expected in the accumulator.
|
| + void EmitAssignment(Expression* expr);
|
| +
|
| // Complete a variable assignment. The right-hand-side value is expected
|
| // in the accumulator.
|
| - void EmitVariableAssignment(Variable* var, Expression::Context context);
|
| + void EmitVariableAssignment(Variable* var,
|
| + Token::Value op,
|
| + Expression::Context context);
|
|
|
| // Complete a named property assignment. The receiver is expected on top
|
| // of the stack and the right-hand-side value in the accumulator.
|
| @@ -385,6 +445,14 @@
|
| // accumulator.
|
| void EmitKeyedPropertyAssignment(Assignment* expr);
|
|
|
| + // Helper for compare operations. Expects the null-value in a register.
|
| + void EmitNullCompare(bool strict,
|
| + Register obj,
|
| + Register null_const,
|
| + Label* if_true,
|
| + Label* if_false,
|
| + Register scratch);
|
| +
|
| void SetFunctionPosition(FunctionLiteral* fun);
|
| void SetReturnPosition(FunctionLiteral* fun);
|
| void SetStatementPosition(Statement* stmt);
|
|
|