OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } else if (FLAG_debug_code) { | 226 } else if (FLAG_debug_code) { |
227 Label done; | 227 Label done; |
228 __ JumpIfInNewSpace(esi, eax, &done, Label::kNear); | 228 __ JumpIfInNewSpace(esi, eax, &done, Label::kNear); |
229 __ Abort(kExpectedNewSpaceObject); | 229 __ Abort(kExpectedNewSpaceObject); |
230 __ bind(&done); | 230 __ bind(&done); |
231 } | 231 } |
232 } | 232 } |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
| 236 // Possibly allocate RestParameters |
| 237 int rest_index; |
| 238 Variable* rest_param = scope()->rest_parameter(&rest_index); |
| 239 if (rest_param) { |
| 240 Comment cmnt(masm_, "[ Allocate rest parameter array"); |
| 241 |
| 242 int num_parameters = info->scope()->num_parameters(); |
| 243 int offset = num_parameters * kPointerSize; |
| 244 __ lea(edx, |
| 245 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); |
| 246 __ push(edx); |
| 247 __ push(Immediate(Smi::FromInt(num_parameters))); |
| 248 __ push(Immediate(Smi::FromInt(rest_index))); |
| 249 |
| 250 RestParamAccessStub stub(isolate()); |
| 251 __ CallStub(&stub); |
| 252 |
| 253 SetVar(rest_param, eax, ebx, edx); |
| 254 } |
| 255 |
236 Variable* arguments = scope()->arguments(); | 256 Variable* arguments = scope()->arguments(); |
237 if (arguments != NULL) { | 257 if (arguments != NULL) { |
238 // Function uses arguments object. | 258 // Function uses arguments object. |
239 Comment cmnt(masm_, "[ Allocate arguments object"); | 259 Comment cmnt(masm_, "[ Allocate arguments object"); |
240 if (function_in_register) { | 260 if (function_in_register) { |
241 __ push(edi); | 261 __ push(edi); |
242 } else { | 262 } else { |
243 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 263 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
244 } | 264 } |
245 // Receiver is just before the parameters on the caller's stack. | 265 // Receiver is just before the parameters on the caller's stack. |
246 int num_parameters = info->scope()->num_parameters(); | 266 int num_parameters = info->scope()->num_parameters(); |
247 int offset = num_parameters * kPointerSize; | 267 int offset = num_parameters * kPointerSize; |
248 __ lea(edx, | 268 __ lea(edx, |
249 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); | 269 Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); |
250 __ push(edx); | 270 __ push(edx); |
251 __ push(Immediate(Smi::FromInt(num_parameters))); | 271 __ push(Immediate(Smi::FromInt(num_parameters))); |
252 // Arguments to ArgumentsAccessStub: | 272 // Arguments to ArgumentsAccessStub: |
253 // function, receiver address, parameter count. | 273 // function, receiver address, parameter count. |
254 // The stub will rewrite receiver and parameter count if the previous | 274 // The stub will rewrite receiver and parameter count if the previous |
255 // stack frame was an arguments adapter frame. | 275 // stack frame was an arguments adapter frame. |
256 ArgumentsAccessStub::Type type; | 276 ArgumentsAccessStub::Type type; |
257 if (is_strict(language_mode())) { | 277 if (is_strict(language_mode()) || !is_simple_parameter_list()) { |
258 type = ArgumentsAccessStub::NEW_STRICT; | 278 type = ArgumentsAccessStub::NEW_STRICT; |
259 } else if (function()->has_duplicate_parameters()) { | 279 } else if (function()->has_duplicate_parameters()) { |
260 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 280 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
261 } else { | 281 } else { |
262 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 282 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
263 } | 283 } |
264 ArgumentsAccessStub::HasNewTarget has_new_target = | 284 ArgumentsAccessStub::HasNewTarget has_new_target = |
265 IsSubclassConstructor(info->function()->kind()) | 285 IsSubclassConstructor(info->function()->kind()) |
266 ? ArgumentsAccessStub::HAS_NEW_TARGET | 286 ? ArgumentsAccessStub::HAS_NEW_TARGET |
267 : ArgumentsAccessStub::NO_NEW_TARGET; | 287 : ArgumentsAccessStub::NO_NEW_TARGET; |
(...skipping 5063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5331 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5351 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5332 Assembler::target_address_at(call_target_address, | 5352 Assembler::target_address_at(call_target_address, |
5333 unoptimized_code)); | 5353 unoptimized_code)); |
5334 return OSR_AFTER_STACK_CHECK; | 5354 return OSR_AFTER_STACK_CHECK; |
5335 } | 5355 } |
5336 | 5356 |
5337 | 5357 |
5338 } } // namespace v8::internal | 5358 } } // namespace v8::internal |
5339 | 5359 |
5340 #endif // V8_TARGET_ARCH_X87 | 5360 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |