OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
15 // | 15 // |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #if defined(V8_TARGET_ARCH_IA32) | 30 #if V8_TARGET_ARCH_IA32 |
31 | 31 |
32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
33 #include "codegen.h" | 33 #include "codegen.h" |
34 #include "compiler.h" | 34 #include "compiler.h" |
35 #include "debug.h" | 35 #include "debug.h" |
36 #include "full-codegen.h" | 36 #include "full-codegen.h" |
37 #include "isolate-inl.h" | 37 #include "isolate-inl.h" |
38 #include "parser.h" | 38 #include "parser.h" |
39 #include "scopes.h" | 39 #include "scopes.h" |
40 #include "stub-cache.h" | 40 #include "stub-cache.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 #endif | 100 #endif |
101 }; | 101 }; |
102 | 102 |
103 | 103 |
104 // Generate code for a JS function. On entry to the function the receiver | 104 // Generate code for a JS function. On entry to the function the receiver |
105 // and arguments have been pushed on the stack left to right, with the | 105 // and arguments have been pushed on the stack left to right, with the |
106 // return address on top of them. The actual argument count matches the | 106 // return address on top of them. The actual argument count matches the |
107 // formal parameter count expected by the function. | 107 // formal parameter count expected by the function. |
108 // | 108 // |
109 // The live registers are: | 109 // The live registers are: |
| 110 // o ecx: CallKind |
110 // o edi: the JS function object being called (i.e. ourselves) | 111 // o edi: the JS function object being called (i.e. ourselves) |
111 // o esi: our context | 112 // o esi: our context |
112 // o ebp: our caller's frame pointer | 113 // o ebp: our caller's frame pointer |
113 // o esp: stack pointer (pointing to return address) | 114 // o esp: stack pointer (pointing to return address) |
114 // | 115 // |
115 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 116 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
116 // frames-ia32.h for its layout. | 117 // frames-ia32.h for its layout. |
117 void FullCodeGenerator::Generate() { | 118 void FullCodeGenerator::Generate() { |
118 CompilationInfo* info = info_; | 119 CompilationInfo* info = info_; |
119 handler_table_ = | 120 handler_table_ = |
(...skipping 4236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4356 | 4357 |
4357 default: | 4358 default: |
4358 UNREACHABLE(); | 4359 UNREACHABLE(); |
4359 } | 4360 } |
4360 } | 4361 } |
4361 | 4362 |
4362 | 4363 |
4363 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, | 4364 void FullCodeGenerator::EmitUnaryOperation(UnaryOperation* expr, |
4364 const char* comment) { | 4365 const char* comment) { |
4365 Comment cmt(masm_, comment); | 4366 Comment cmt(masm_, comment); |
4366 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | 4367 UnaryOpStub stub(expr->op()); |
4367 UnaryOverwriteMode overwrite = | |
4368 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | |
4369 UnaryOpStub stub(expr->op(), overwrite); | |
4370 // UnaryOpStub expects the argument to be in the | 4368 // UnaryOpStub expects the argument to be in the |
4371 // accumulator register eax. | 4369 // accumulator register eax. |
4372 VisitForAccumulatorValue(expr->expression()); | 4370 VisitForAccumulatorValue(expr->expression()); |
4373 SetSourcePosition(expr->position()); | 4371 SetSourcePosition(expr->position()); |
4374 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, | 4372 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
4375 expr->UnaryOperationFeedbackId()); | 4373 expr->UnaryOperationFeedbackId()); |
4376 context()->Plug(eax); | 4374 context()->Plug(eax); |
4377 } | 4375 } |
4378 | 4376 |
4379 | 4377 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4918 *stack_depth = 0; | 4916 *stack_depth = 0; |
4919 *context_length = 0; | 4917 *context_length = 0; |
4920 return previous_; | 4918 return previous_; |
4921 } | 4919 } |
4922 | 4920 |
4923 #undef __ | 4921 #undef __ |
4924 | 4922 |
4925 } } // namespace v8::internal | 4923 } } // namespace v8::internal |
4926 | 4924 |
4927 #endif // V8_TARGET_ARCH_IA32 | 4925 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |