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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 // Get the code for the given builtin. Returns if able to resolve | 332 // Get the code for the given builtin. Returns if able to resolve |
333 // the function in the 'resolved' flag. | 333 // the function in the 'resolved' flag. |
334 Handle<Code> ResolveBuiltin(Builtins::JavaScript id, bool* resolved); | 334 Handle<Code> ResolveBuiltin(Builtins::JavaScript id, bool* resolved); |
335 | 335 |
336 // Activation support. | 336 // Activation support. |
337 void EnterFrame(StackFrame::Type type); | 337 void EnterFrame(StackFrame::Type type); |
338 void LeaveFrame(StackFrame::Type type); | 338 void LeaveFrame(StackFrame::Type type); |
339 }; | 339 }; |
340 | 340 |
341 | 341 |
| 342 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 343 // The code patcher is used to patch (typically) small parts of code e.g. for |
| 344 // debugging and other types of instrumentation. When using the code patcher |
| 345 // the exact number of bytes specified must be emitted. It is not legal to emit |
| 346 // relocation information. If any of these constraints are violated it causes |
| 347 // an assertion to fail. |
| 348 class CodePatcher { |
| 349 public: |
| 350 CodePatcher(byte* address, int instructions); |
| 351 virtual ~CodePatcher(); |
| 352 |
| 353 // Macro assembler to emit code. |
| 354 MacroAssembler* masm() { return &masm_; } |
| 355 |
| 356 // Emit an instruction directly. |
| 357 void Emit(Instr x); |
| 358 |
| 359 // Emit an address directly. |
| 360 void Emit(Address addr); |
| 361 |
| 362 private: |
| 363 byte* address_; // The address of the code being patched. |
| 364 int instructions_; // Number of instructions of the expected patch size. |
| 365 int size_; // Number of bytes of the expected patch size. |
| 366 MacroAssembler masm_; // Macro assembler used to generate the code. |
| 367 }; |
| 368 #endif // ENABLE_DEBUGGER_SUPPORT |
| 369 |
| 370 |
342 // ----------------------------------------------------------------------------- | 371 // ----------------------------------------------------------------------------- |
343 // Static helper functions. | 372 // Static helper functions. |
344 | 373 |
345 // Generate a MemOperand for loading a field from an object. | 374 // Generate a MemOperand for loading a field from an object. |
346 static inline MemOperand FieldMemOperand(Register object, int offset) { | 375 static inline MemOperand FieldMemOperand(Register object, int offset) { |
347 return MemOperand(object, offset - kHeapObjectTag); | 376 return MemOperand(object, offset - kHeapObjectTag); |
348 } | 377 } |
349 | 378 |
350 | 379 |
351 #ifdef GENERATED_CODE_COVERAGE | 380 #ifdef GENERATED_CODE_COVERAGE |
352 #define CODE_COVERAGE_STRINGIFY(x) #x | 381 #define CODE_COVERAGE_STRINGIFY(x) #x |
353 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 382 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
354 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 383 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
355 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 384 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
356 #else | 385 #else |
357 #define ACCESS_MASM(masm) masm-> | 386 #define ACCESS_MASM(masm) masm-> |
358 #endif | 387 #endif |
359 | 388 |
360 | 389 |
361 } } // namespace v8::internal | 390 } } // namespace v8::internal |
362 | 391 |
363 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 392 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
OLD | NEW |