| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 CALL_JS, | 50 CALL_JS, |
| 51 JUMP_JS | 51 JUMP_JS |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 | 54 |
| 55 // MacroAssembler implements a collection of frequently used macros. | 55 // MacroAssembler implements a collection of frequently used macros. |
| 56 class MacroAssembler: public Assembler { | 56 class MacroAssembler: public Assembler { |
| 57 public: | 57 public: |
| 58 MacroAssembler(void* buffer, int size); | 58 MacroAssembler(void* buffer, int size); |
| 59 | 59 |
| 60 // --------------------------------------------------------------------------- | 60 // Jump, Call, and Ret pseudo instructions implementing inter-working. |
| 61 // Low-level helpers for compiler | |
| 62 | |
| 63 // Jump, Call, and Ret pseudo instructions implementing inter-working | |
| 64 private: | |
| 65 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); | |
| 66 void Call(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); | |
| 67 public: | |
| 68 void Jump(Register target, Condition cond = al); | 61 void Jump(Register target, Condition cond = al); |
| 69 void Jump(byte* target, RelocInfo::Mode rmode, Condition cond = al); | 62 void Jump(byte* target, RelocInfo::Mode rmode, Condition cond = al); |
| 70 void Jump(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al); | 63 void Jump(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al); |
| 71 void Call(Register target, Condition cond = al); | 64 void Call(Register target, Condition cond = al); |
| 72 void Call(byte* target, RelocInfo::Mode rmode, Condition cond = al); | 65 void Call(byte* target, RelocInfo::Mode rmode, Condition cond = al); |
| 73 void Call(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al); | 66 void Call(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al); |
| 74 void Ret(Condition cond = al); | 67 void Ret(Condition cond = al); |
| 75 | 68 |
| 76 // Emit code to discard a non-negative number of pointer-sized elements | 69 // Emit code to discard a non-negative number of pointer-sized elements |
| 77 // from the stack, clobbering only the sp register. | 70 // from the stack, clobbering only the sp register. |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 380 |
| 388 // Checks if both objects are sequential ASCII strings and jumps to label | 381 // Checks if both objects are sequential ASCII strings and jumps to label |
| 389 // if either is not. | 382 // if either is not. |
| 390 void JumpIfNotBothSequentialAsciiStrings(Register first, | 383 void JumpIfNotBothSequentialAsciiStrings(Register first, |
| 391 Register second, | 384 Register second, |
| 392 Register scratch1, | 385 Register scratch1, |
| 393 Register scratch2, | 386 Register scratch2, |
| 394 Label* not_flat_ascii_strings); | 387 Label* not_flat_ascii_strings); |
| 395 | 388 |
| 396 private: | 389 private: |
| 397 List<Unresolved> unresolved_; | 390 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); |
| 398 bool generating_stub_; | 391 void Call(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); |
| 399 bool allow_stub_calls_; | |
| 400 Handle<Object> code_object_; // This handle will be patched with the code | |
| 401 // object on installation. | |
| 402 | 392 |
| 403 // Helper functions for generating invokes. | 393 // Helper functions for generating invokes. |
| 404 void InvokePrologue(const ParameterCount& expected, | 394 void InvokePrologue(const ParameterCount& expected, |
| 405 const ParameterCount& actual, | 395 const ParameterCount& actual, |
| 406 Handle<Code> code_constant, | 396 Handle<Code> code_constant, |
| 407 Register code_reg, | 397 Register code_reg, |
| 408 Label* done, | 398 Label* done, |
| 409 InvokeFlag flag); | 399 InvokeFlag flag); |
| 410 | 400 |
| 411 // Prepares for a call or jump to a builtin by doing two things: | 401 // Prepares for a call or jump to a builtin by doing two things: |
| 412 // 1. Emits code that fetches the builtin's function object from the context | 402 // 1. Emits code that fetches the builtin's function object from the context |
| 413 // at runtime, and puts it in the register rdi. | 403 // at runtime, and puts it in the register rdi. |
| 414 // 2. Fetches the builtin's code object, and returns it in a handle, at | 404 // 2. Fetches the builtin's code object, and returns it in a handle, at |
| 415 // compile time, so that later code can emit instructions to jump or call | 405 // compile time, so that later code can emit instructions to jump or call |
| 416 // the builtin directly. If the code object has not yet been created, it | 406 // the builtin directly. If the code object has not yet been created, it |
| 417 // returns the builtin code object for IllegalFunction, and sets the | 407 // returns the builtin code object for IllegalFunction, and sets the |
| 418 // output parameter "resolved" to false. Code that uses the return value | 408 // output parameter "resolved" to false. Code that uses the return value |
| 419 // should then add the address and the builtin name to the list of fixups | 409 // should then add the address and the builtin name to the list of fixups |
| 420 // called unresolved_, which is fixed up by the bootstrapper. | 410 // called unresolved_, which is fixed up by the bootstrapper. |
| 421 Handle<Code> ResolveBuiltin(Builtins::JavaScript id, bool* resolved); | 411 Handle<Code> ResolveBuiltin(Builtins::JavaScript id, bool* resolved); |
| 422 | 412 |
| 423 // Activation support. | 413 // Activation support. |
| 424 void EnterFrame(StackFrame::Type type); | 414 void EnterFrame(StackFrame::Type type); |
| 425 void LeaveFrame(StackFrame::Type type); | 415 void LeaveFrame(StackFrame::Type type); |
| 416 |
| 417 List<Unresolved> unresolved_; |
| 418 bool generating_stub_; |
| 419 bool allow_stub_calls_; |
| 420 // This handle will be patched with the code object on installation. |
| 421 Handle<Object> code_object_; |
| 426 }; | 422 }; |
| 427 | 423 |
| 428 | 424 |
| 429 #ifdef ENABLE_DEBUGGER_SUPPORT | 425 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 430 // The code patcher is used to patch (typically) small parts of code e.g. for | 426 // The code patcher is used to patch (typically) small parts of code e.g. for |
| 431 // debugging and other types of instrumentation. When using the code patcher | 427 // debugging and other types of instrumentation. When using the code patcher |
| 432 // the exact number of bytes specified must be emitted. It is not legal to emit | 428 // the exact number of bytes specified must be emitted. It is not legal to emit |
| 433 // relocation information. If any of these constraints are violated it causes | 429 // relocation information. If any of these constraints are violated it causes |
| 434 // an assertion to fail. | 430 // an assertion to fail. |
| 435 class CodePatcher { | 431 class CodePatcher { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 464 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 460 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 465 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 461 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 466 #else | 462 #else |
| 467 #define ACCESS_MASM(masm) masm-> | 463 #define ACCESS_MASM(masm) masm-> |
| 468 #endif | 464 #endif |
| 469 | 465 |
| 470 | 466 |
| 471 } } // namespace v8::internal | 467 } } // namespace v8::internal |
| 472 | 468 |
| 473 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 469 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| OLD | NEW |