| OLD | NEW |
| 1 // Copyright 2011 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. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 SetFunctionPosition(function()); | 122 SetFunctionPosition(function()); |
| 123 Comment cmnt(masm_, "[ function compiled by full code generator"); | 123 Comment cmnt(masm_, "[ function compiled by full code generator"); |
| 124 | 124 |
| 125 #ifdef DEBUG | 125 #ifdef DEBUG |
| 126 if (strlen(FLAG_stop_at) > 0 && | 126 if (strlen(FLAG_stop_at) > 0 && |
| 127 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 127 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
| 128 __ int3(); | 128 __ int3(); |
| 129 } | 129 } |
| 130 #endif | 130 #endif |
| 131 | 131 |
| 132 // We can optionally optimize based on counters rather than statistical |
| 133 // sampling. |
| 134 if (info->ShouldSelfOptimize()) { |
| 135 if (FLAG_trace_opt) { |
| 136 PrintF("[adding self-optimization header to %s]\n", |
| 137 *info->function()->debug_name()->ToCString()); |
| 138 } |
| 139 MaybeObject* maybe_cell = isolate()->heap()->AllocateJSGlobalPropertyCell( |
| 140 Smi::FromInt(Compiler::kCallsUntilPrimitiveOpt)); |
| 141 JSGlobalPropertyCell* cell; |
| 142 if (maybe_cell->To(&cell)) { |
| 143 __ movq(rax, Handle<JSGlobalPropertyCell>(cell), |
| 144 RelocInfo::EMBEDDED_OBJECT); |
| 145 __ SmiAddConstant(FieldOperand(rax, JSGlobalPropertyCell::kValueOffset), |
| 146 Smi::FromInt(-1)); |
| 147 Handle<Code> compile_stub( |
| 148 isolate()->builtins()->builtin(Builtins::kLazyRecompile)); |
| 149 __ j(zero, compile_stub, RelocInfo::CODE_TARGET); |
| 150 } |
| 151 } |
| 152 |
| 132 // Strict mode functions and builtins need to replace the receiver | 153 // Strict mode functions and builtins need to replace the receiver |
| 133 // with undefined when called as functions (without an explicit | 154 // with undefined when called as functions (without an explicit |
| 134 // receiver object). rcx is zero for method calls and non-zero for | 155 // receiver object). rcx is zero for method calls and non-zero for |
| 135 // function calls. | 156 // function calls. |
| 136 if (!info->is_classic_mode() || info->is_native()) { | 157 if (!info->is_classic_mode() || info->is_native()) { |
| 137 Label ok; | 158 Label ok; |
| 138 __ testq(rcx, rcx); | 159 __ testq(rcx, rcx); |
| 139 __ j(zero, &ok, Label::kNear); | 160 __ j(zero, &ok, Label::kNear); |
| 140 // +1 for return address. | 161 // +1 for return address. |
| 141 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; | 162 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; |
| (...skipping 4223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4365 *context_length = 0; | 4386 *context_length = 0; |
| 4366 return previous_; | 4387 return previous_; |
| 4367 } | 4388 } |
| 4368 | 4389 |
| 4369 | 4390 |
| 4370 #undef __ | 4391 #undef __ |
| 4371 | 4392 |
| 4372 } } // namespace v8::internal | 4393 } } // namespace v8::internal |
| 4373 | 4394 |
| 4374 #endif // V8_TARGET_ARCH_X64 | 4395 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |