| Index: src/ia32/codegen-ia32.h
|
| ===================================================================
|
| --- src/ia32/codegen-ia32.h (revision 3935)
|
| +++ src/ia32/codegen-ia32.h (working copy)
|
| @@ -294,15 +294,6 @@
|
|
|
| class CodeGenerator: public AstVisitor {
|
| public:
|
| - // Compilation mode. Either the compiler is used as the primary
|
| - // compiler and needs to setup everything or the compiler is used as
|
| - // the secondary compiler for split compilation and has to handle
|
| - // bailouts.
|
| - enum Mode {
|
| - PRIMARY,
|
| - SECONDARY
|
| - };
|
| -
|
| // Takes a function literal, generates code for it. This function should only
|
| // be called by compiler.cc.
|
| static Handle<Code> MakeCode(CompilationInfo* info);
|
| @@ -384,7 +375,7 @@
|
| void VisitStatementsAndSpill(ZoneList<Statement*>* statements);
|
|
|
| // Main code generation function
|
| - void Generate(CompilationInfo* info, Mode mode);
|
| + void Generate(CompilationInfo* info);
|
|
|
| // Generate the return sequence code. Should be called no more than
|
| // once per compiled function, immediately after binding the return
|
| @@ -429,8 +420,8 @@
|
| void LoadAndSpill(Expression* expression);
|
|
|
| // Read a value from a slot and leave it on top of the expression stack.
|
| - void LoadFromSlot(Slot* slot, TypeofState typeof_state);
|
| - void LoadFromSlotCheckForArguments(Slot* slot, TypeofState typeof_state);
|
| + Result LoadFromSlot(Slot* slot, TypeofState typeof_state);
|
| + Result LoadFromSlotCheckForArguments(Slot* slot, TypeofState typeof_state);
|
| Result LoadFromGlobalSlotCheckExtensions(Slot* slot,
|
| TypeofState typeof_state,
|
| JumpTarget* slow);
|
| @@ -439,11 +430,24 @@
|
| // value in place.
|
| void StoreToSlot(Slot* slot, InitState init_state);
|
|
|
| - // Load a property of an object, returning it in a Result.
|
| - // The object and the property name are passed on the stack, and
|
| - // not changed.
|
| - Result EmitKeyedLoad(bool is_global);
|
| + // Support for compiling assignment expressions.
|
| + void EmitSlotAssignment(Assignment* node);
|
| + void EmitNamedPropertyAssignment(Assignment* node);
|
| + void EmitKeyedPropertyAssignment(Assignment* node);
|
|
|
| + // Receiver is passed on the frame and consumed.
|
| + Result EmitNamedLoad(Handle<String> name, bool is_contextual);
|
| +
|
| + // If the store is contextual, value is passed on the frame and consumed.
|
| + // Otherwise, receiver and value are passed on the frame and consumed.
|
| + Result EmitNamedStore(Handle<String> name, bool is_contextual);
|
| +
|
| + // Receiver and key are passed on the frame and consumed.
|
| + Result EmitKeyedLoad();
|
| +
|
| + // Receiver, key, and value are passed on the frame and consumed.
|
| + Result EmitKeyedStore(StaticType* key_type);
|
| +
|
| // Special code for typeof expressions: Unfortunately, we must
|
| // be careful when loading the expression in 'typeof'
|
| // expressions. We are not allowed to throw reference errors for
|
| @@ -533,12 +537,13 @@
|
| void DeclareGlobals(Handle<FixedArray> pairs);
|
|
|
| // Instantiate the function boilerplate.
|
| - void InstantiateBoilerplate(Handle<JSFunction> boilerplate);
|
| + Result InstantiateBoilerplate(Handle<JSFunction> boilerplate);
|
|
|
| // Support for type checks.
|
| void GenerateIsSmi(ZoneList<Expression*>* args);
|
| void GenerateIsNonNegativeSmi(ZoneList<Expression*>* args);
|
| void GenerateIsArray(ZoneList<Expression*>* args);
|
| + void GenerateIsRegExp(ZoneList<Expression*>* args);
|
| void GenerateIsObject(ZoneList<Expression*>* args);
|
| void GenerateIsFunction(ZoneList<Expression*>* args);
|
| void GenerateIsUndetectableObject(ZoneList<Expression*>* args);
|
| @@ -580,6 +585,13 @@
|
| // Support for direct calls from JavaScript to native RegExp code.
|
| void GenerateRegExpExec(ZoneList<Expression*>* args);
|
|
|
| + // Fast support for number to string.
|
| + void GenerateNumberToString(ZoneList<Expression*>* args);
|
| +
|
| + // Fast call to transcendental functions.
|
| + void GenerateMathSin(ZoneList<Expression*>* args);
|
| + void GenerateMathCos(ZoneList<Expression*>* args);
|
| +
|
| // Simple condition analysis.
|
| enum ConditionAnalysis {
|
| ALWAYS_TRUE,
|
| @@ -647,6 +659,22 @@
|
| };
|
|
|
|
|
| +// Compute a transcendental math function natively, or call the
|
| +// TranscendentalCache runtime function.
|
| +class TranscendentalCacheStub: public CodeStub {
|
| + public:
|
| + explicit TranscendentalCacheStub(TranscendentalCache::Type type)
|
| + : type_(type) {}
|
| + void Generate(MacroAssembler* masm);
|
| + private:
|
| + TranscendentalCache::Type type_;
|
| + Major MajorKey() { return TranscendentalCache; }
|
| + int MinorKey() { return type_; }
|
| + Runtime::FunctionId RuntimeFunction();
|
| + void GenerateOperation(MacroAssembler* masm);
|
| +};
|
| +
|
| +
|
| // Flag that indicates how to generate code for the stub GenericBinaryOpStub.
|
| enum GenericBinaryFlags {
|
| NO_GENERIC_BINARY_FLAGS = 0,
|
| @@ -658,13 +686,15 @@
|
| public:
|
| GenericBinaryOpStub(Token::Value op,
|
| OverwriteMode mode,
|
| - GenericBinaryFlags flags)
|
| + GenericBinaryFlags flags,
|
| + NumberInfo::Type operands_type = NumberInfo::kUnknown)
|
| : op_(op),
|
| mode_(mode),
|
| flags_(flags),
|
| args_in_registers_(false),
|
| args_reversed_(false),
|
| - name_(NULL) {
|
| + name_(NULL),
|
| + operands_type_(operands_type) {
|
| use_sse3_ = CpuFeatures::IsSupported(SSE3);
|
| ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
|
| }
|
| @@ -689,28 +719,32 @@
|
| bool args_reversed_; // Left and right argument are swapped.
|
| bool use_sse3_;
|
| char* name_;
|
| + NumberInfo::Type operands_type_; // Number type information of operands.
|
|
|
| const char* GetName();
|
|
|
| #ifdef DEBUG
|
| void Print() {
|
| - PrintF("GenericBinaryOpStub (op %s), "
|
| - "(mode %d, flags %d, registers %d, reversed %d)\n",
|
| + PrintF("GenericBinaryOpStub %d (op %s), "
|
| + "(mode %d, flags %d, registers %d, reversed %d, number_info %s)\n",
|
| + MinorKey(),
|
| Token::String(op_),
|
| static_cast<int>(mode_),
|
| static_cast<int>(flags_),
|
| static_cast<int>(args_in_registers_),
|
| - static_cast<int>(args_reversed_));
|
| + static_cast<int>(args_reversed_),
|
| + NumberInfo::ToString(operands_type_));
|
| }
|
| #endif
|
|
|
| - // Minor key encoding in 16 bits FRASOOOOOOOOOOMM.
|
| + // Minor key encoding in 16 bits NNNFRASOOOOOOOMM.
|
| class ModeBits: public BitField<OverwriteMode, 0, 2> {};
|
| - class OpBits: public BitField<Token::Value, 2, 10> {};
|
| - class SSE3Bits: public BitField<bool, 12, 1> {};
|
| - class ArgsInRegistersBits: public BitField<bool, 13, 1> {};
|
| - class ArgsReversedBits: public BitField<bool, 14, 1> {};
|
| - class FlagBits: public BitField<GenericBinaryFlags, 15, 1> {};
|
| + class OpBits: public BitField<Token::Value, 2, 7> {};
|
| + class SSE3Bits: public BitField<bool, 9, 1> {};
|
| + class ArgsInRegistersBits: public BitField<bool, 10, 1> {};
|
| + class ArgsReversedBits: public BitField<bool, 11, 1> {};
|
| + class FlagBits: public BitField<GenericBinaryFlags, 12, 1> {};
|
| + class NumberInfoBits: public BitField<NumberInfo::Type, 13, 3> {};
|
|
|
| Major MajorKey() { return GenericBinaryOp; }
|
| int MinorKey() {
|
| @@ -720,7 +754,8 @@
|
| | FlagBits::encode(flags_)
|
| | SSE3Bits::encode(use_sse3_)
|
| | ArgsInRegistersBits::encode(args_in_registers_)
|
| - | ArgsReversedBits::encode(args_reversed_);
|
| + | ArgsReversedBits::encode(args_reversed_)
|
| + | NumberInfoBits::encode(operands_type_);
|
| }
|
|
|
| void Generate(MacroAssembler* masm);
|
| @@ -767,6 +802,31 @@
|
| Register count, // Must be ecx.
|
| Register scratch, // Neither of the above.
|
| bool ascii);
|
| +
|
| + // Probe the symbol table for a two character string. If the string is
|
| + // not found by probing a jump to the label not_found is performed. This jump
|
| + // does not guarantee that the string is not in the symbol table. If the
|
| + // string is found the code falls through with the string in register eax.
|
| + void GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm,
|
| + Register c1,
|
| + Register c2,
|
| + Register scratch1,
|
| + Register scratch2,
|
| + Register scratch3,
|
| + Label* not_found);
|
| +
|
| + // Generate string hash.
|
| + void GenerateHashInit(MacroAssembler* masm,
|
| + Register hash,
|
| + Register character,
|
| + Register scratch);
|
| + void GenerateHashAddCharacter(MacroAssembler* masm,
|
| + Register hash,
|
| + Register character,
|
| + Register scratch);
|
| + void GenerateHashGetHash(MacroAssembler* masm,
|
| + Register hash,
|
| + Register scratch);
|
| };
|
|
|
|
|
| @@ -828,6 +888,39 @@
|
| };
|
|
|
|
|
| +class NumberToStringStub: public CodeStub {
|
| + public:
|
| + NumberToStringStub() { }
|
| +
|
| + // Generate code to do a lookup in the number string cache. If the number in
|
| + // the register object is found in the cache the generated code falls through
|
| + // with the result in the result register. The object and the result register
|
| + // can be the same. If the number is not found in the cache the code jumps to
|
| + // the label not_found with only the content of register object unchanged.
|
| + static void GenerateLookupNumberStringCache(MacroAssembler* masm,
|
| + Register object,
|
| + Register result,
|
| + Register scratch1,
|
| + Register scratch2,
|
| + bool object_is_smi,
|
| + Label* not_found);
|
| +
|
| + private:
|
| + Major MajorKey() { return NumberToString; }
|
| + int MinorKey() { return 0; }
|
| +
|
| + void Generate(MacroAssembler* masm);
|
| +
|
| + const char* GetName() { return "NumberToStringStub"; }
|
| +
|
| +#ifdef DEBUG
|
| + void Print() {
|
| + PrintF("NumberToStringStub\n");
|
| + }
|
| +#endif
|
| +};
|
| +
|
| +
|
| } } // namespace v8::internal
|
|
|
| #endif // V8_IA32_CODEGEN_IA32_H_
|
|
|