Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | |
| 2 // Redistribution and use in source and binary forms, with or without | |
| 3 // modification, are permitted provided that the following conditions are | |
| 4 // met: | |
| 5 // | |
| 6 // * Redistributions of source code must retain the above copyright | |
| 7 // notice, this list of conditions and the following disclaimer. | |
| 8 // * Redistributions in binary form must reproduce the above | |
| 9 // copyright notice, this list of conditions and the following | |
| 10 // disclaimer in the documentation and/or other materials provided | |
| 11 // with the distribution. | |
| 12 // * Neither the name of Google Inc. nor the names of its | |
| 13 // contributors may be used to endorse or promote products derived | |
| 14 // from this software without specific prior written permission. | |
| 15 // | |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | |
| 28 | |
| 29 #ifndef V8_MIPS_CODEGEN_MIPS_H_ | |
| 30 #define V8_MIPS_CODEGEN_MIPS_H_ | |
| 31 | |
| 32 namespace v8 { | |
| 33 namespace internal { | |
| 34 | |
| 35 // Forward declarations | |
| 36 class DeferredCode; | |
| 37 class RegisterAllocator; | |
| 38 class RegisterFile; | |
| 39 | |
| 40 enum InitState { CONST_INIT, NOT_CONST_INIT }; | |
| 41 enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; | |
| 42 | |
| 43 | |
| 44 // ------------------------------------------------------------------------- | |
| 45 // Reference support | |
| 46 | |
| 47 // A reference is a C++ stack-allocated object that keeps an ECMA | |
| 48 // reference on the execution stack while in scope. For variables | |
| 49 // the reference is empty, indicating that it isn't necessary to | |
| 50 // store state on the stack for keeping track of references to those. | |
| 51 // For properties, we keep either one (named) or two (indexed) values | |
| 52 // on the execution stack to represent the reference. | |
| 53 | |
| 54 class Reference BASE_EMBEDDED { | |
| 55 public: | |
| 56 // The values of the types is important, see size(). | |
| 57 enum Type { ILLEGAL = -1, SLOT = 0, NAMED = 1, KEYED = 2 }; | |
| 58 Reference(CodeGenerator* cgen, Expression* expression); | |
| 59 ~Reference(); | |
| 60 | |
| 61 Expression* expression() const { return expression_; } | |
| 62 Type type() const { return type_; } | |
| 63 void set_type(Type value) { | |
| 64 ASSERT(type_ == ILLEGAL); | |
| 65 type_ = value; | |
| 66 } | |
| 67 | |
| 68 // The size the reference takes up on the stack. | |
| 69 int size() const { return (type_ == ILLEGAL) ? 0 : type_; } | |
| 70 | |
| 71 bool is_illegal() const { return type_ == ILLEGAL; } | |
| 72 bool is_slot() const { return type_ == SLOT; } | |
| 73 bool is_property() const { return type_ == NAMED || type_ == KEYED; } | |
| 74 | |
| 75 // Return the name. Only valid for named property references. | |
| 76 Handle<String> GetName(); | |
| 77 | |
| 78 // Generate code to push the value of the reference on top of the | |
| 79 // expression stack. The reference is expected to be already on top of | |
| 80 // the expression stack, and it is left in place with its value above it. | |
| 81 void GetValue(); | |
| 82 | |
| 83 // Generate code to push the value of a reference on top of the expression | |
| 84 // stack and then spill the stack frame. This function is used temporarily | |
| 85 // while the code generator is being transformed. | |
| 86 inline void GetValueAndSpill(); | |
| 87 | |
| 88 // Generate code to store the value on top of the expression stack in the | |
| 89 // reference. The reference is expected to be immediately below the value | |
| 90 // on the expression stack. The stored value is left in place (with the | |
| 91 // reference intact below it) to support chained assignments. | |
| 92 void SetValue(InitState init_state); | |
| 93 | |
| 94 private: | |
| 95 CodeGenerator* cgen_; | |
| 96 Expression* expression_; | |
| 97 Type type_; | |
| 98 }; | |
| 99 | |
| 100 | |
| 101 // ------------------------------------------------------------------------- | |
| 102 // Code generation state | |
| 103 | |
| 104 // The state is passed down the AST by the code generator (and back up, in | |
| 105 // the form of the state of the label pair). It is threaded through the | |
| 106 // call stack. Constructing a state implicitly pushes it on the owning code | |
| 107 // generator's stack of states, and destroying one implicitly pops it. | |
| 108 | |
| 109 class CodeGenState BASE_EMBEDDED { | |
| 110 public: | |
| 111 // Create an initial code generator state. Destroying the initial state | |
| 112 // leaves the code generator with a NULL state. | |
| 113 explicit CodeGenState(CodeGenerator* owner); | |
| 114 | |
| 115 // Create a code generator state based on a code generator's current | |
| 116 // state. The new state has its own typeof state and pair of branch | |
| 117 // labels. | |
| 118 CodeGenState(CodeGenerator* owner, | |
| 119 JumpTarget* true_target, | |
| 120 JumpTarget* false_target); | |
| 121 | |
| 122 // Destroy a code generator state and restore the owning code generator's | |
| 123 // previous state. | |
| 124 ~CodeGenState(); | |
| 125 | |
| 126 TypeofState typeof_state() const { return typeof_state_; } | |
| 127 JumpTarget* true_target() const { return true_target_; } | |
| 128 JumpTarget* false_target() const { return false_target_; } | |
| 129 | |
| 130 private: | |
| 131 // The owning code generator. | |
| 132 CodeGenerator* owner_; | |
| 133 | |
| 134 // A flag indicating whether we are compiling the immediate subexpression | |
| 135 // of a typeof expression. | |
| 136 TypeofState typeof_state_; | |
| 137 | |
| 138 JumpTarget* true_target_; | |
| 139 JumpTarget* false_target_; | |
| 140 | |
| 141 // The previous state of the owning code generator, restored when | |
| 142 // this state is destroyed. | |
| 143 CodeGenState* previous_; | |
| 144 }; | |
| 145 | |
| 146 | |
| 147 | |
| 148 // ------------------------------------------------------------------------- | |
| 149 // CodeGenerator | |
| 150 | |
| 151 class CodeGenerator: public AstVisitor { | |
| 152 public: | |
| 153 // Takes a function literal, generates code for it. This function should only | |
| 154 // be called by compiler.cc. | |
| 155 static Handle<Code> MakeCode(FunctionLiteral* fun, | |
| 156 Handle<Script> script, | |
| 157 bool is_eval); | |
| 158 | |
| 159 // Printing of AST, etc. as requested by flags. | |
| 160 static void MakeCodePrologue(FunctionLiteral* fun); | |
| 161 | |
| 162 // Allocate and install the code. | |
| 163 static Handle<Code> MakeCodeEpilogue(FunctionLiteral* fun, | |
| 164 MacroAssembler* masm, | |
| 165 Code::Flags flags, | |
| 166 Handle<Script> script); | |
| 167 | |
| 168 #ifdef ENABLE_LOGGING_AND_PROFILING | |
| 169 static bool ShouldGenerateLog(Expression* type); | |
| 170 #endif | |
| 171 | |
| 172 static void SetFunctionInfo(Handle<JSFunction> fun, | |
| 173 FunctionLiteral* lit, | |
| 174 bool is_toplevel, | |
| 175 Handle<Script> script); | |
| 176 | |
| 177 static void RecordPositions(MacroAssembler* masm, int pos); | |
| 178 | |
| 179 // Accessors | |
| 180 MacroAssembler* masm() { return masm_; } | |
| 181 VirtualFrame* frame() const { return frame_; } | |
| 182 Handle<Script> script() { return script_; } | |
| 183 | |
| 184 bool has_valid_frame() const { return frame_ != NULL; } | |
| 185 | |
| 186 // Set the virtual frame to be new_frame, with non-frame register | |
| 187 // reference counts given by non_frame_registers. The non-frame | |
| 188 // register reference counts of the old frame are returned in | |
| 189 // non_frame_registers. | |
| 190 void SetFrame(VirtualFrame* new_frame, RegisterFile* non_frame_registers); | |
| 191 | |
| 192 void DeleteFrame(); | |
| 193 | |
| 194 RegisterAllocator* allocator() const { return allocator_; } | |
| 195 | |
| 196 CodeGenState* state() { return state_; } | |
| 197 void set_state(CodeGenState* state) { state_ = state; } | |
| 198 | |
| 199 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } | |
| 200 | |
| 201 static const int kUnknownIntValue = -1; | |
| 202 | |
| 203 // Number of instructions used for the JS return sequence. The constant is | |
| 204 // used by the debugger to patch the JS return sequence. | |
| 205 static const int kJSReturnSequenceLength = 6; | |
| 206 | |
| 207 private: | |
| 208 // Construction/Destruction | |
| 209 CodeGenerator(int buffer_size, Handle<Script> script, bool is_eval); | |
| 210 virtual ~CodeGenerator() { delete masm_; } | |
| 211 | |
| 212 // Accessors | |
| 213 Scope* scope() const { return scope_; } | |
| 214 | |
| 215 // Generating deferred code. | |
| 216 void ProcessDeferred(); | |
| 217 | |
| 218 bool is_eval() { return is_eval_; } | |
| 219 | |
| 220 // State | |
| 221 bool has_cc() const { return cc_reg_ != cc_always; } | |
| 222 TypeofState typeof_state() const { return state_->typeof_state(); } | |
| 223 JumpTarget* true_target() const { return state_->true_target(); } | |
| 224 JumpTarget* false_target() const { return state_->false_target(); } | |
| 225 | |
| 226 // We don't track loop nesting level on mips yet. | |
| 227 int loop_nesting() const { return 0; } | |
| 228 | |
| 229 // Node visitors. | |
| 230 void VisitStatements(ZoneList<Statement*>* statements); | |
| 231 | |
| 232 #define DEF_VISIT(type) \ | |
| 233 void Visit##type(type* node); | |
| 234 AST_NODE_LIST(DEF_VISIT) | |
| 235 #undef DEF_VISIT | |
| 236 | |
| 237 // Visit a statement and then spill the virtual frame if control flow can | |
| 238 // reach the end of the statement (ie, it does not exit via break, | |
| 239 // continue, return, or throw). This function is used temporarily while | |
| 240 // the code generator is being transformed. | |
| 241 inline void VisitAndSpill(Statement* statement); | |
| 242 | |
| 243 // Visit a list of statements and then spill the virtual frame if control | |
| 244 // flow can reach the end of the list. | |
| 245 inline void VisitStatementsAndSpill(ZoneList<Statement*>* statements); | |
| 246 | |
| 247 // Main code generation function | |
| 248 void GenCode(FunctionLiteral* fun); | |
| 249 | |
| 250 // The following are used by class Reference. | |
| 251 void LoadReference(Reference* ref); | |
| 252 void UnloadReference(Reference* ref); | |
| 253 | |
| 254 MemOperand ContextOperand(Register context, int index) const { | |
| 255 return MemOperand(context, Context::SlotOffset(index)); | |
| 256 } | |
| 257 | |
| 258 MemOperand SlotOperand(Slot* slot, Register tmp); | |
| 259 | |
| 260 MemOperand ContextSlotOperandCheckExtensions(Slot* slot, | |
| 261 Register tmp, | |
| 262 Register tmp2, | |
| 263 JumpTarget* slow); | |
| 264 | |
| 265 // Expressions | |
| 266 MemOperand GlobalObject() const { | |
| 267 return ContextOperand(cp, Context::GLOBAL_INDEX); | |
| 268 } | |
| 269 | |
| 270 void LoadCondition(Expression* x, | |
| 271 JumpTarget* true_target, | |
| 272 JumpTarget* false_target, | |
| 273 bool force_cc); | |
| 274 void Load(Expression* x); | |
| 275 void LoadGlobal(); | |
| 276 void LoadGlobalReceiver(Register scratch); | |
| 277 | |
| 278 // Generate code to push the value of an expression on top of the frame | |
| 279 // and then spill the frame fully to memory. This function is used | |
| 280 // temporarily while the code generator is being transformed. | |
| 281 inline void LoadAndSpill(Expression* expression); | |
| 282 | |
| 283 // Call LoadCondition and then spill the virtual frame unless control flow | |
| 284 // cannot reach the end of the expression (ie, by emitting only | |
| 285 // unconditional jumps to the control targets). | |
| 286 inline void LoadConditionAndSpill(Expression* expression, | |
| 287 JumpTarget* true_target, | |
| 288 JumpTarget* false_target, | |
| 289 bool force_control); | |
| 290 | |
| 291 // Read a value from a slot and leave it on top of the expression stack. | |
| 292 void LoadFromSlot(Slot* slot, TypeofState typeof_state); | |
| 293 void LoadFromGlobalSlotCheckExtensions(Slot* slot, | |
| 294 TypeofState typeof_state, | |
| 295 Register tmp, | |
| 296 Register tmp2, | |
| 297 JumpTarget* slow); | |
| 298 | |
| 299 // Special code for typeof expressions: Unfortunately, we must | |
| 300 // be careful when loading the expression in 'typeof' | |
| 301 // expressions. We are not allowed to throw reference errors for | |
| 302 // non-existing properties of the global object, so we must make it | |
| 303 // look like an explicit property access, instead of an access | |
| 304 // through the context chain. | |
| 305 void LoadTypeofExpression(Expression* x); | |
| 306 | |
| 307 void ToBoolean(JumpTarget* true_target, JumpTarget* false_target); | |
| 308 | |
| 309 void GenericBinaryOperation(Token::Value op, | |
| 310 OverwriteMode overwrite_mode, | |
| 311 int known_rhs = kUnknownIntValue); | |
| 312 void Comparison(Condition cc, | |
| 313 Expression* left, | |
| 314 Expression* right, | |
| 315 bool strict = false); | |
| 316 | |
| 317 void SmiOperation(Token::Value op, | |
| 318 Handle<Object> value, | |
| 319 bool reversed, | |
| 320 OverwriteMode mode); | |
| 321 | |
| 322 void CallWithArguments(ZoneList<Expression*>* arguments, int position); | |
| 323 | |
| 324 // Control flow | |
| 325 void Branch(bool if_true, JumpTarget* target); | |
| 326 void CheckStack(); | |
| 327 | |
| 328 struct InlineRuntimeLUT { | |
| 329 void (CodeGenerator::*method)(ZoneList<Expression*>*); | |
| 330 const char* name; | |
| 331 }; | |
| 332 | |
| 333 static InlineRuntimeLUT* FindInlineRuntimeLUT(Handle<String> name); | |
| 334 bool CheckForInlineRuntimeCall(CallRuntime* node); | |
| 335 static bool PatchInlineRuntimeEntry(Handle<String> name, | |
| 336 const InlineRuntimeLUT& new_entry, | |
| 337 InlineRuntimeLUT* old_entry); | |
| 338 | |
| 339 static Handle<Code> ComputeLazyCompile(int argc); | |
| 340 void ProcessDeclarations(ZoneList<Declaration*>* declarations); | |
| 341 | |
| 342 Handle<Code> ComputeCallInitialize(int argc, InLoopFlag in_loop); | |
| 343 | |
| 344 // Declare global variables and functions in the given array of | |
| 345 // name/value pairs. | |
| 346 void DeclareGlobals(Handle<FixedArray> pairs); | |
| 347 | |
| 348 // Instantiate the function boilerplate. | |
| 349 void InstantiateBoilerplate(Handle<JSFunction> boilerplate); | |
| 350 | |
| 351 // Support for type checks. | |
| 352 void GenerateIsSmi(ZoneList<Expression*>* args); | |
| 353 void GenerateIsNonNegativeSmi(ZoneList<Expression*>* args); | |
| 354 void GenerateIsArray(ZoneList<Expression*>* args); | |
| 355 | |
| 356 // Support for construct call checks. | |
| 357 void GenerateIsConstructCall(ZoneList<Expression*>* args); | |
| 358 | |
| 359 // Support for arguments.length and arguments[?]. | |
| 360 void GenerateArgumentsLength(ZoneList<Expression*>* args); | |
| 361 void GenerateArgumentsAccess(ZoneList<Expression*>* args); | |
| 362 | |
| 363 // Support for accessing the class and value fields of an object. | |
| 364 void GenerateClassOf(ZoneList<Expression*>* args); | |
| 365 void GenerateValueOf(ZoneList<Expression*>* args); | |
| 366 void GenerateSetValueOf(ZoneList<Expression*>* args); | |
| 367 | |
| 368 // Fast support for charCodeAt(n). | |
| 369 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); | |
| 370 | |
| 371 // Fast support for object equality testing. | |
| 372 void GenerateObjectEquals(ZoneList<Expression*>* args); | |
| 373 | |
| 374 void GenerateLog(ZoneList<Expression*>* args); | |
| 375 | |
| 376 // Fast support for Math.random(). | |
| 377 void GenerateRandomPositiveSmi(ZoneList<Expression*>* args); | |
| 378 | |
| 379 // Fast support for Math.sin and Math.cos. | |
| 380 enum MathOp { SIN, COS }; | |
| 381 void GenerateFastMathOp(MathOp op, ZoneList<Expression*>* args); | |
| 382 inline void GenerateMathSin(ZoneList<Expression*>* args); | |
| 383 inline void GenerateMathCos(ZoneList<Expression*>* args); | |
| 384 | |
| 385 // Simple condition analysis. | |
| 386 enum ConditionAnalysis { | |
| 387 ALWAYS_TRUE, | |
| 388 ALWAYS_FALSE, | |
| 389 DONT_KNOW | |
| 390 }; | |
| 391 ConditionAnalysis AnalyzeCondition(Expression* cond); | |
| 392 | |
| 393 // Methods used to indicate which source code is generated for. Source | |
| 394 // positions are collected by the assembler and emitted with the relocation | |
| 395 // information. | |
| 396 void CodeForFunctionPosition(FunctionLiteral* fun); | |
| 397 void CodeForReturnPosition(FunctionLiteral* fun); | |
| 398 void CodeForStatementPosition(Statement* node); | |
| 399 void CodeForSourcePosition(int pos); | |
| 400 | |
| 401 #ifdef DEBUG | |
| 402 // True if the registers are valid for entry to a block. | |
| 403 bool HasValidEntryRegisters(); | |
| 404 #endif | |
| 405 | |
| 406 bool is_eval_; // Tells whether code is generated for eval. | |
| 407 | |
| 408 Handle<Script> script_; | |
| 409 List<DeferredCode*> deferred_; | |
| 410 | |
| 411 // Assembler | |
| 412 MacroAssembler* masm_; // to generate code | |
| 413 | |
| 414 // Code generation state | |
| 415 Scope* scope_; | |
| 416 VirtualFrame* frame_; | |
| 417 RegisterAllocator* allocator_; | |
| 418 Condition cc_reg_; | |
| 419 CodeGenState* state_; | |
| 420 | |
| 421 // Jump targets | |
| 422 BreakTarget function_return_; | |
| 423 | |
| 424 // True if the function return is shadowed (ie, jumping to the target | |
| 425 // function_return_ does not jump to the true function return, but rather | |
| 426 // to some unlinking code). | |
| 427 bool function_return_is_shadowed_; | |
| 428 | |
| 429 static InlineRuntimeLUT kInlineRuntimeLUT[]; | |
| 430 | |
| 431 friend class VirtualFrame; | |
| 432 friend class JumpTarget; | |
| 433 friend class Reference; | |
| 434 friend class FastCodeGenerator; | |
| 435 friend class CodeGenSelector; | |
| 436 | |
| 437 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | |
| 438 }; | |
| 439 | |
| 440 | |
| 441 class GenericBinaryOpStub : public CodeStub { | |
| 442 public: | |
| 443 GenericBinaryOpStub(Token::Value op, | |
| 444 OverwriteMode mode, | |
| 445 int constant_rhs = CodeGenerator::kUnknownIntValue) | |
| 446 : op_(op), | |
| 447 mode_(mode), | |
| 448 constant_rhs_(constant_rhs), | |
| 449 specialized_on_rhs_(RhsIsOneWeWantToOptimizeFor(op, constant_rhs)) { } | |
| 450 | |
| 451 private: | |
| 452 Token::Value op_; | |
| 453 OverwriteMode mode_; | |
| 454 int constant_rhs_; | |
| 455 bool specialized_on_rhs_; | |
| 456 | |
| 457 static const int kMaxKnownRhs = 0x40000000; | |
| 458 | |
| 459 // Minor key encoding in 16 bits. | |
| 460 class ModeBits: public BitField<OverwriteMode, 0, 2> {}; | |
| 461 class OpBits: public BitField<Token::Value, 2, 6> {}; | |
| 462 class KnownIntBits: public BitField<int, 8, 8> {}; | |
| 463 | |
| 464 Major MajorKey() { return GenericBinaryOp; } | |
| 465 int MinorKey() { | |
| 466 // // Encode the parameters in a unique 16 bit value. | |
|
Søren Thygesen Gjesse
2010/01/19 22:59:12
Please remove code in comments.
Alexandre
2010/01/22 23:08:42
Style issue fixed.
On 2010/01/19 22:59:12, Søren G
| |
| 467 // return OpBits::encode(op_) | |
| 468 // | ModeBits::encode(mode_) | |
| 469 // | KnownIntBits::encode(MinorKeyForKnownInt()); | |
| 470 return -1; // UNIMPLEMENTED RETURN | |
| 471 } | |
| 472 | |
| 473 void Generate(MacroAssembler* masm); | |
| 474 void HandleNonSmiBitwiseOp(MacroAssembler* masm); | |
| 475 | |
| 476 static bool RhsIsOneWeWantToOptimizeFor(Token::Value op, int constant_rhs) { | |
| 477 // if (constant_rhs == CodeGenerator::kUnknownIntValue) return false; | |
|
Søren Thygesen Gjesse
2010/01/19 22:59:12
Ditto.
Alexandre
2010/01/22 23:08:42
Style issue fixed.
On 2010/01/19 22:59:12, Søren G
| |
| 478 // if (op == Token::DIV) return constant_rhs >= 2 && constant_rhs <= 3; | |
| 479 // if (op == Token::MOD) { | |
| 480 // if (constant_rhs <= 1) return false; | |
| 481 // if (constant_rhs <= 10) return true; | |
| 482 // if (constant_rhs <= kMaxKnownRhs && IsPowerOf2(constant_rhs)) return tru e; | |
| 483 // return false; | |
| 484 // } | |
| 485 // return false; | |
| 486 return false; // UNIMPLEMENTED RETURN | |
| 487 } | |
| 488 | |
| 489 int MinorKeyForKnownInt() { | |
| 490 // if (!specialized_on_rhs_) return 0; | |
|
Søren Thygesen Gjesse
2010/01/19 22:59:12
Ditto.
Alexandre
2010/01/22 23:08:42
Style issue fixed.
On 2010/01/19 22:59:12, Søren G
| |
| 491 // if (constant_rhs_ <= 10) return constant_rhs_ + 1; | |
| 492 // ASSERT(IsPowerOf2(constant_rhs_)); | |
| 493 // int key = 12; | |
| 494 // int d = constant_rhs_; | |
| 495 // while ((d & 1) == 0) { | |
| 496 // key++; | |
| 497 // d >>= 1; | |
| 498 // } | |
| 499 // return key; | |
| 500 return -1; // UNIMPLEMENTED RETURN | |
| 501 } | |
| 502 | |
| 503 const char* GetName() { | |
| 504 switch (op_) { | |
| 505 case Token::ADD: return "GenericBinaryOpStub_ADD"; | |
| 506 case Token::SUB: return "GenericBinaryOpStub_SUB"; | |
| 507 case Token::MUL: return "GenericBinaryOpStub_MUL"; | |
| 508 case Token::DIV: return "GenericBinaryOpStub_DIV"; | |
| 509 case Token::MOD: return "GenericBinaryOpStub_MOD"; | |
| 510 case Token::BIT_OR: return "GenericBinaryOpStub_BIT_OR"; | |
| 511 case Token::BIT_AND: return "GenericBinaryOpStub_BIT_AND"; | |
| 512 case Token::BIT_XOR: return "GenericBinaryOpStub_BIT_XOR"; | |
| 513 case Token::SAR: return "GenericBinaryOpStub_SAR"; | |
| 514 case Token::SHL: return "GenericBinaryOpStub_SHL"; | |
| 515 case Token::SHR: return "GenericBinaryOpStub_SHR"; | |
| 516 default: return "GenericBinaryOpStub"; | |
| 517 } | |
| 518 } | |
| 519 | |
| 520 #ifdef DEBUG | |
| 521 void Print() { | |
| 522 // if (!specialized_on_rhs_) { | |
|
Søren Thygesen Gjesse
2010/01/19 22:59:12
Ditto.
Alexandre
2010/01/22 23:08:42
Style issue fixed.
On 2010/01/19 22:59:12, Søren G
| |
| 523 // PrintF("GenericBinaryOpStub (%s)\n", Token::String(op_)); | |
| 524 // } else { | |
| 525 // PrintF("GenericBinaryOpStub (%s by %d)\n", | |
| 526 // Token::String(op_), | |
| 527 // constant_rhs_); | |
| 528 // } | |
| 529 } | |
| 530 #endif | |
| 531 }; | |
| 532 | |
| 533 | |
| 534 | |
| 535 } } // namespace v8::internal | |
| 536 | |
| 537 #endif // V8_MIPS_CODEGEN_MIPS_H_ | |
| OLD | NEW |