OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 void MacroAssembler::Check(Condition cc, const char* msg) { | 53 void MacroAssembler::Check(Condition cc, const char* msg) { |
54 Label L; | 54 Label L; |
55 j(cc, &L); | 55 j(cc, &L); |
56 Abort(msg); | 56 Abort(msg); |
57 // will not return here | 57 // will not return here |
58 bind(&L); | 58 bind(&L); |
59 } | 59 } |
60 | 60 |
61 | 61 |
| 62 void MacroAssembler::ConstructAndTestJSFunction() { |
| 63 const int initial_buffer_size = 4 * KB; |
| 64 char* buffer = new char[initial_buffer_size]; |
| 65 MacroAssembler masm(buffer, initial_buffer_size); |
| 66 #define __ ACCESS_MASM((&masm)) |
| 67 // Construct a simple JSfunction here, using Assembler and MacroAssembler |
| 68 // commands. |
| 69 __ int3(); |
| 70 #undef __ |
| 71 CodeDesc desc; |
| 72 masm.GetCode(&desc); |
| 73 // TODO(X64): Create the function object and call it. |
| 74 } |
| 75 |
| 76 |
62 void MacroAssembler::Abort(const char* msg) { | 77 void MacroAssembler::Abort(const char* msg) { |
63 // We want to pass the msg string like a smi to avoid GC | 78 // We want to pass the msg string like a smi to avoid GC |
64 // problems, however msg is not guaranteed to be aligned | 79 // problems, however msg is not guaranteed to be aligned |
65 // properly. Instead, we pass an aligned pointer that is | 80 // properly. Instead, we pass an aligned pointer that is |
66 // a proper v8 smi, but also pass the alignment difference | 81 // a proper v8 smi, but also pass the alignment difference |
67 // from the real pointer as a smi. | 82 // from the real pointer as a smi. |
68 intptr_t p1 = reinterpret_cast<intptr_t>(msg); | 83 intptr_t p1 = reinterpret_cast<intptr_t>(msg); |
69 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | 84 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; |
70 // Note: p0 might not be a valid Smi *value*, but it has a valid Smi tag. | 85 // Note: p0 might not be a valid Smi *value*, but it has a valid Smi tag. |
71 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | 86 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 push(rcx); | 456 push(rcx); |
442 | 457 |
443 // Clear the top frame. | 458 // Clear the top frame. |
444 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address); | 459 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address); |
445 movq(kScratchRegister, c_entry_fp_address); | 460 movq(kScratchRegister, c_entry_fp_address); |
446 movq(Operand(kScratchRegister, 0), Immediate(0)); | 461 movq(Operand(kScratchRegister, 0), Immediate(0)); |
447 } | 462 } |
448 | 463 |
449 | 464 |
450 } } // namespace v8::internal | 465 } } // namespace v8::internal |
OLD | NEW |