#include "bootstrapper.h"
#include "codegen-inl.h"
#include "debug.h"
-#include "scopes.h"
#include "runtime.h"
+#include "scopes.h"
+#include "virtual-frame.h"
namespace v8 { namespace internal {
}
+void CodeGenerator::LoadConditionAndSpill(Expression* expression,
+ TypeofState typeof_state,
+ JumpTarget* true_target,
+ JumpTarget* false_target,
+ bool force_control) {
+ ASSERT(in_spilled_code());
+ set_in_spilled_code(false);
+ LoadCondition(expression, typeof_state, true_target, false_target,
+ force_control);
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
+ set_in_spilled_code(true);
+}
+
+
// Loads a value on TOS. If it is a boolean value, the result may have been
// (partially) translated into branches, or it may have set the condition
// code register. If force_cc is set, the value is forced to set the
}
+void CodeGenerator::LoadAndSpill(Expression* expression,
+ TypeofState typeof_state) {
+ ASSERT(in_spilled_code());
+ set_in_spilled_code(false);
+ Load(expression, typeof_state);
+ frame_->SpillAll();
+ set_in_spilled_code(true);
+}
+
+
void CodeGenerator::Load(Expression* x, TypeofState typeof_state) {
#ifdef DEBUG
int original_height = frame_->height();
}
+void CodeGenerator::VisitAndSpill(Statement* statement) {
+ ASSERT(in_spilled_code());
+ set_in_spilled_code(false);
+ Visit(statement);
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
+ set_in_spilled_code(true);
+}
+
+
+void CodeGenerator::VisitStatementsAndSpill(ZoneList<Statement*>* statements) {
+ ASSERT(in_spilled_code());
+ set_in_spilled_code(false);
+ VisitStatements(statements);
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
+ set_in_spilled_code(true);
+}
+
+
void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) {
#ifdef DEBUG
int original_height = frame_->height();
}
+void Reference::GetValueAndSpill(TypeofState typeof_state) {
+ ASSERT(cgen_->in_spilled_code());
+ cgen_->set_in_spilled_code(false);
+ GetValue(typeof_state);
+ cgen_->frame()->SpillAll();
+ cgen_->set_in_spilled_code(true);
+}
+
+
void Reference::GetValue(TypeofState typeof_state) {
ASSERT(!cgen_->in_spilled_code());
ASSERT(cgen_->HasValidEntryRegisters());
#ifndef V8_CODEGEN_ARM_H_
#define V8_CODEGEN_ARM_H_
-#include "scopes.h"
-
namespace v8 { namespace internal {
// Forward declarations
class DeferredCode;
+class RegisterAllocator;
+class RegisterFile;
// Mode to overwrite BinaryExpression values.
enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT };
// reach the end of the statement (ie, it does not exit via break,
// continue, return, or throw). This function is used temporarily while
// the code generator is being transformed.
- void VisitAndSpill(Statement* statement) {
- ASSERT(in_spilled_code());
- set_in_spilled_code(false);
- Visit(statement);
- if (frame_ != NULL) {
- frame_->SpillAll();
- }
- set_in_spilled_code(true);
- }
+ void VisitAndSpill(Statement* statement);
// Visit a list of statements and then spill the virtual frame if control
// flow can reach the end of the list.
- void VisitStatementsAndSpill(ZoneList<Statement*>* statements) {
- ASSERT(in_spilled_code());
- set_in_spilled_code(false);
- VisitStatements(statements);
- if (frame_ != NULL) {
- frame_->SpillAll();
- }
- set_in_spilled_code(true);
- }
+ void VisitStatementsAndSpill(ZoneList<Statement*>* statements);
// Main code generation function
void GenCode(FunctionLiteral* fun);
// and then spill the frame fully to memory. This function is used
// temporarily while the code generator is being transformed.
void LoadAndSpill(Expression* expression,
- TypeofState typeof_state = NOT_INSIDE_TYPEOF) {
- ASSERT(in_spilled_code());
- set_in_spilled_code(false);
- Load(expression, typeof_state);
- frame_->SpillAll();
- set_in_spilled_code(true);
- }
+ TypeofState typeof_state = NOT_INSIDE_TYPEOF);
// Call LoadCondition and then spill the virtual frame unless control flow
// cannot reach the end of the expression (ie, by emitting only
TypeofState typeof_state,
JumpTarget* true_target,
JumpTarget* false_target,
- bool force_control) {
- ASSERT(in_spilled_code());
- set_in_spilled_code(false);
- LoadCondition(expression, typeof_state, true_target, false_target,
- force_control);
- if (frame_ != NULL) {
- frame_->SpillAll();
- }
- set_in_spilled_code(true);
- }
+ bool force_control);
// Read a value from a slot and leave it on top of the expression stack.
void LoadFromSlot(Slot* slot, TypeofState typeof_state);
};
-void Reference::GetValueAndSpill(TypeofState typeof_state) {
- ASSERT(cgen_->in_spilled_code());
- cgen_->set_in_spilled_code(false);
- GetValue(typeof_state);
- cgen_->frame()->SpillAll();
- cgen_->set_in_spilled_code(true);
-}
-
-
} } // namespace v8::internal
#endif // V8_CODEGEN_ARM_H_
#include "bootstrapper.h"
#include "codegen-inl.h"
#include "debug.h"
-#include "scopes.h"
#include "runtime.h"
+#include "scopes.h"
+#include "virtual-frame.h"
namespace v8 { namespace internal {
}
+void CodeGenerator::LoadAndSpill(Expression* expression,
+ TypeofState typeof_state) {
+ ASSERT(in_spilled_code());
+ set_in_spilled_code(false);
+ Load(expression, typeof_state);
+ frame_->SpillAll();
+ set_in_spilled_code(true);
+}
+
+
void CodeGenerator::Load(Expression* x, TypeofState typeof_state) {
#ifdef DEBUG
int original_height = frame_->height();
}
+void CodeGenerator::VisitAndSpill(Statement* statement) {
+ ASSERT(in_spilled_code());
+ set_in_spilled_code(false);
+ Visit(statement);
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
+ set_in_spilled_code(true);
+}
+
+
+void CodeGenerator::VisitStatementsAndSpill(ZoneList<Statement*>* statements) {
+ ASSERT(in_spilled_code());
+ set_in_spilled_code(false);
+ VisitStatements(statements);
+ if (frame_ != NULL) {
+ frame_->SpillAll();
+ }
+ set_in_spilled_code(true);
+}
+
+
void CodeGenerator::VisitStatements(ZoneList<Statement*>* statements) {
ASSERT(!in_spilled_code());
for (int i = 0; has_valid_frame() && i < statements->length(); i++) {
#ifndef V8_CODEGEN_IA32_H_
#define V8_CODEGEN_IA32_H_
-#include "scopes.h"
-#include "register-allocator.h"
-
namespace v8 { namespace internal {
// Forward declarations
class DeferredCode;
+class RegisterAllocator;
+class RegisterFile;
// Mode to overwrite BinaryExpression values.
enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT };
// the expression stack, and it is left in place with its value above it.
void GetValue(TypeofState typeof_state);
- // Generate code to push the value of a reference on top of the expression
- // stack and then spill the stack frame. This function is used temporarily
- // while the code generator is being transformed.
- inline void GetValueAndSpill(TypeofState typeof_state);
-
// Like GetValue except that the slot is expected to be written to before
// being read from again. Thae value of the reference may be invalidated,
// causing subsequent attempts to read it to fail.
// reach the end of the statement (ie, it does not exit via break,
// continue, return, or throw). This function is used temporarily while
// the code generator is being transformed.
- void VisitAndSpill(Statement* statement) {
- ASSERT(in_spilled_code());
- set_in_spilled_code(false);
- Visit(statement);
- if (frame_ != NULL) {
- frame_->SpillAll();
- }
- set_in_spilled_code(true);
- }
+ void VisitAndSpill(Statement* statement);
// Visit a list of statements and then spill the virtual frame if control
// flow can reach the end of the list.
- void VisitStatementsAndSpill(ZoneList<Statement*>* statements) {
- ASSERT(in_spilled_code());
- set_in_spilled_code(false);
- VisitStatements(statements);
- if (frame_ != NULL) {
- frame_->SpillAll();
- }
- set_in_spilled_code(true);
- }
+ void VisitStatementsAndSpill(ZoneList<Statement*>* statements);
// Main code generation function
void GenCode(FunctionLiteral* fun);
// and then spill the frame fully to memory. This function is used
// temporarily while the code generator is being transformed.
void LoadAndSpill(Expression* expression,
- TypeofState typeof_state = NOT_INSIDE_TYPEOF) {
- ASSERT(in_spilled_code());
- set_in_spilled_code(false);
- Load(expression, typeof_state);
- frame_->SpillAll();
- set_in_spilled_code(true);
- }
-
- // Call LoadCondition and then spill the virtual frame unless control flow
- // cannot reach the end of the expression (ie, by emitting only
- // unconditional jumps to the control targets).
- void LoadConditionAndSpill(Expression* expression,
- TypeofState typeof_state,
- ControlDestination* destination,
- bool force_control) {
- ASSERT(in_spilled_code());
- set_in_spilled_code(false);
- LoadCondition(expression, typeof_state, destination, force_control);
- if (frame_ != NULL) {
- frame_->SpillAll();
- }
- set_in_spilled_code(true);
- }
+ TypeofState typeof_state = NOT_INSIDE_TYPEOF);
// Read a value from a slot and leave it on top of the expression stack.
void LoadFromSlot(Slot* slot, TypeofState typeof_state);
};
-void Reference::GetValueAndSpill(TypeofState typeof_state) {
- ASSERT(cgen_->in_spilled_code());
- cgen_->set_in_spilled_code(false);
- GetValue(typeof_state);
- cgen_->frame()->SpillAll();
- cgen_->set_in_spilled_code(true);
-}
-
-
} } // namespace v8::internal
#endif // V8_CODEGEN_IA32_H_
#include "codegen.h"
-
namespace v8 { namespace internal {
#include "codegen-inl.h"
#include "debug.h"
#include "prettyprinter.h"
-#include "scopeinfo.h"
#include "runtime.h"
+#include "scopeinfo.h"
#include "stub-cache.h"
+#include "virtual-frame.h"
namespace v8 { namespace internal {
#include "v8.h"
#include "codegen.h"
-#include "jump-target.h"
+#include "virtual-frame.h"
namespace v8 { namespace internal {
#include "v8.h"
#include "codegen.h"
-#include "jump-target.h"
+#include "virtual-frame.h"
namespace v8 { namespace internal {
#include "v8.h"
#include "codegen.h"
-#include "jump-target.h"
+#include "virtual-frame.h"
namespace v8 { namespace internal {
#ifndef V8_JUMP_TARGET_H_
#define V8_JUMP_TARGET_H_
-#include "virtual-frame.h"
-
namespace v8 { namespace internal {
+// Forward declarations.
+class FrameElement;
+class Result;
+class VirtualFrame;
+
+
// -------------------------------------------------------------------------
// Jump targets
//
#include "v8.h"
#include "codegen.h"
-#include "register-allocator.h"
+#include "virtual-frame.h"
namespace v8 { namespace internal {
#include "v8.h"
#include "codegen.h"
-#include "register-allocator.h"
+#include "virtual-frame.h"
namespace v8 { namespace internal {
#include "v8.h"
-#include "codegen.h"
#include "codegen-inl.h"
+#include "scopes.h"
#include "virtual-frame.h"
namespace v8 { namespace internal {
#ifndef V8_VIRTUAL_FRAME_ARM_H_
#define V8_VIRTUAL_FRAME_ARM_H_
+#include "register-allocator.h"
+
namespace v8 { namespace internal {
// -------------------------------------------------------------------------
#include "v8.h"
-#include "codegen.h"
#include "codegen-inl.h"
+#include "scopes.h"
#include "virtual-frame.h"
namespace v8 { namespace internal {
#ifndef V8_VIRTUAL_FRAME_IA32_H_
#define V8_VIRTUAL_FRAME_IA32_H_
+#include "register-allocator.h"
+
namespace v8 { namespace internal {
// -------------------------------------------------------------------------
#define V8_VIRTUAL_FRAME_H_
#include "macro-assembler.h"
-#include "register-allocator.h"
namespace v8 { namespace internal {