OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 21 matching lines...) Expand all Loading... |
32 #include "debug.h" | 32 #include "debug.h" |
33 #include "runtime.h" | 33 #include "runtime.h" |
34 #include "serialize.h" | 34 #include "serialize.h" |
35 | 35 |
36 namespace v8 { namespace internal { | 36 namespace v8 { namespace internal { |
37 | 37 |
38 MacroAssembler::MacroAssembler(void* buffer, int size) | 38 MacroAssembler::MacroAssembler(void* buffer, int size) |
39 : Assembler(buffer, size), | 39 : Assembler(buffer, size), |
40 unresolved_(0), | 40 unresolved_(0), |
41 generating_stub_(false), | 41 generating_stub_(false), |
42 allow_stub_calls_(true) { | 42 allow_stub_calls_(true), |
| 43 code_object_(Heap::undefined_value()) { |
43 } | 44 } |
44 | 45 |
45 | 46 |
46 static void RecordWriteHelper(MacroAssembler* masm, | 47 static void RecordWriteHelper(MacroAssembler* masm, |
47 Register object, | 48 Register object, |
48 Register addr, | 49 Register addr, |
49 Register scratch) { | 50 Register scratch) { |
50 Label fast; | 51 Label fast; |
51 | 52 |
52 // Compute the page address from the heap object pointer, leave it | 53 // Compute the page address from the heap object pointer, leave it |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 sahf(); | 311 sahf(); |
311 pop(eax); | 312 pop(eax); |
312 } | 313 } |
313 | 314 |
314 | 315 |
315 void MacroAssembler::EnterFrame(StackFrame::Type type) { | 316 void MacroAssembler::EnterFrame(StackFrame::Type type) { |
316 push(ebp); | 317 push(ebp); |
317 mov(ebp, Operand(esp)); | 318 mov(ebp, Operand(esp)); |
318 push(esi); | 319 push(esi); |
319 push(Immediate(Smi::FromInt(type))); | 320 push(Immediate(Smi::FromInt(type))); |
320 push(Immediate(0)); // Push an empty code cache slot. | 321 push(Immediate(CodeObject())); |
| 322 if (FLAG_debug_code) { |
| 323 cmp(Operand(esp, 0), Immediate(Factory::undefined_value())); |
| 324 Check(not_equal, "code object not properly patched"); |
| 325 } |
321 } | 326 } |
322 | 327 |
323 | 328 |
324 void MacroAssembler::LeaveFrame(StackFrame::Type type) { | 329 void MacroAssembler::LeaveFrame(StackFrame::Type type) { |
325 if (FLAG_debug_code) { | 330 if (FLAG_debug_code) { |
326 cmp(Operand(ebp, StandardFrameConstants::kMarkerOffset), | 331 cmp(Operand(ebp, StandardFrameConstants::kMarkerOffset), |
327 Immediate(Smi::FromInt(type))); | 332 Immediate(Smi::FromInt(type))); |
328 Check(equal, "stack frame types must match"); | 333 Check(equal, "stack frame types must match"); |
329 } | 334 } |
330 leave(); | 335 leave(); |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 // Indicate that code has changed. | 1012 // Indicate that code has changed. |
1008 CPU::FlushICache(address_, size_); | 1013 CPU::FlushICache(address_, size_); |
1009 | 1014 |
1010 // Check that the code was patched as expected. | 1015 // Check that the code was patched as expected. |
1011 ASSERT(masm_.pc_ == address_ + size_); | 1016 ASSERT(masm_.pc_ == address_ + size_); |
1012 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1017 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1013 } | 1018 } |
1014 | 1019 |
1015 | 1020 |
1016 } } // namespace v8::internal | 1021 } } // namespace v8::internal |
OLD | NEW |