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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 masm_(new MacroAssembler(NULL, buffer_size)), | 51 masm_(new MacroAssembler(NULL, buffer_size)), |
52 scope_(NULL), | 52 scope_(NULL), |
53 frame_(NULL), | 53 frame_(NULL), |
54 allocator_(NULL), | 54 allocator_(NULL), |
55 state_(NULL), | 55 state_(NULL), |
56 loop_nesting_(0), | 56 loop_nesting_(0), |
57 function_return_is_shadowed_(false), | 57 function_return_is_shadowed_(false), |
58 in_spilled_code_(false) { | 58 in_spilled_code_(false) { |
59 } | 59 } |
60 | 60 |
61 #define __ ACCESS_MASM(masm) | 61 #define __ ACCESS_MASM(masm_) |
62 | 62 |
63 | 63 |
64 void CodeGenerator::DeclareGlobals(Handle<FixedArray> a) { | 64 void CodeGenerator::DeclareGlobals(Handle<FixedArray> a) { |
65 UNIMPLEMENTED(); | 65 UNIMPLEMENTED(); |
66 } | 66 } |
67 | 67 |
| 68 void CodeGenerator::TestCodeGenerator() { |
| 69 // Generate code. |
| 70 const int initial_buffer_size = 4 * KB; |
| 71 CodeGenerator cgen(initial_buffer_size, NULL, false); |
| 72 CodeGeneratorScope scope(&cgen); |
| 73 cgen.GenCode(NULL); |
| 74 |
| 75 CodeDesc desc; |
| 76 cgen.masm()->GetCode(&desc); |
| 77 } |
| 78 |
| 79 |
68 void CodeGenerator::GenCode(FunctionLiteral* a) { | 80 void CodeGenerator::GenCode(FunctionLiteral* a) { |
69 masm_->int3(); // UNIMPLEMENTED | 81 if (a != NULL) { |
| 82 __ int3(); // UNIMPLEMENTED |
| 83 } else { |
| 84 // GenCode Implementation under construction. Run by TestCodeGenerator |
| 85 // with a == NULL. |
| 86 __ movq(rax, Immediate(0x2a)); |
| 87 __ Ret(); |
| 88 } |
70 } | 89 } |
71 | 90 |
72 void CodeGenerator::GenerateFastCaseSwitchJumpTable(SwitchStatement* a, | 91 void CodeGenerator::GenerateFastCaseSwitchJumpTable(SwitchStatement* a, |
73 int b, | 92 int b, |
74 int c, | 93 int c, |
75 Label* d, | 94 Label* d, |
76 Vector<Label*> e, | 95 Vector<Label*> e, |
77 Vector<Label> f) { | 96 Vector<Label> f) { |
78 UNIMPLEMENTED(); | 97 UNIMPLEMENTED(); |
79 } | 98 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 247 } |
229 | 248 |
230 void CodeGenerator::VisitCompareOperation(CompareOperation* a) { | 249 void CodeGenerator::VisitCompareOperation(CompareOperation* a) { |
231 UNIMPLEMENTED(); | 250 UNIMPLEMENTED(); |
232 } | 251 } |
233 | 252 |
234 void CodeGenerator::VisitThisFunction(ThisFunction* a) { | 253 void CodeGenerator::VisitThisFunction(ThisFunction* a) { |
235 UNIMPLEMENTED(); | 254 UNIMPLEMENTED(); |
236 } | 255 } |
237 | 256 |
| 257 #undef __ |
| 258 // End of CodeGenerator implementation. |
| 259 |
| 260 // ----------------------------------------------------------------------------- |
| 261 // Implementation of stubs. |
| 262 |
| 263 // Stub classes have public member named masm, not masm_. |
| 264 #define __ ACCESS_MASM(masm) |
238 | 265 |
239 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { | 266 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { |
240 // Check that stack should contain frame pointer, code pointer, state and | 267 // Check that stack should contain frame pointer, code pointer, state and |
241 // return address in that order. | 268 // return address in that order. |
242 ASSERT_EQ(StackHandlerConstants::kFPOffset + kPointerSize, | 269 ASSERT_EQ(StackHandlerConstants::kFPOffset + kPointerSize, |
243 StackHandlerConstants::kStateOffset); | 270 StackHandlerConstants::kStateOffset); |
244 ASSERT_EQ(StackHandlerConstants::kStateOffset + kPointerSize, | 271 ASSERT_EQ(StackHandlerConstants::kStateOffset + kPointerSize, |
245 StackHandlerConstants::kPCOffset); | 272 StackHandlerConstants::kPCOffset); |
246 | 273 |
247 ExternalReference handler_address(Top::k_handler_address); | 274 ExternalReference handler_address(Top::k_handler_address); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 595 |
569 // Restore frame pointer and return. | 596 // Restore frame pointer and return. |
570 __ pop(rbp); | 597 __ pop(rbp); |
571 __ ret(0); | 598 __ ret(0); |
572 } | 599 } |
573 | 600 |
574 | 601 |
575 #undef __ | 602 #undef __ |
576 | 603 |
577 } } // namespace v8::internal | 604 } } // namespace v8::internal |
OLD | NEW |