OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } else if (FLAG_debug_code) { | 238 } else if (FLAG_debug_code) { |
239 Label done; | 239 Label done; |
240 __ JumpIfInNewSpace(cp, r3, &done); | 240 __ JumpIfInNewSpace(cp, r3, &done); |
241 __ Abort(kExpectedNewSpaceObject); | 241 __ Abort(kExpectedNewSpaceObject); |
242 __ bind(&done); | 242 __ bind(&done); |
243 } | 243 } |
244 } | 244 } |
245 } | 245 } |
246 } | 246 } |
247 | 247 |
| 248 ArgumentsAccessStub::HasNewTarget has_new_target = |
| 249 IsSubclassConstructor(info->function()->kind()) |
| 250 ? ArgumentsAccessStub::HAS_NEW_TARGET |
| 251 : ArgumentsAccessStub::NO_NEW_TARGET; |
| 252 |
248 // Possibly allocate RestParameters | 253 // Possibly allocate RestParameters |
249 int rest_index; | 254 int rest_index; |
250 Variable* rest_param = scope()->rest_parameter(&rest_index); | 255 Variable* rest_param = scope()->rest_parameter(&rest_index); |
251 if (rest_param) { | 256 if (rest_param) { |
252 Comment cmnt(masm_, "[ Allocate rest parameter array"); | 257 Comment cmnt(masm_, "[ Allocate rest parameter array"); |
253 | 258 |
254 int num_parameters = info->scope()->num_parameters(); | 259 int num_parameters = info->scope()->num_parameters(); |
255 int offset = num_parameters * kPointerSize; | 260 int offset = num_parameters * kPointerSize; |
| 261 if (has_new_target == ArgumentsAccessStub::HAS_NEW_TARGET) { |
| 262 --num_parameters; |
| 263 ++rest_index; |
| 264 } |
| 265 |
256 __ addi(r6, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset)); | 266 __ addi(r6, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset)); |
257 __ mov(r5, Operand(Smi::FromInt(num_parameters))); | 267 __ mov(r5, Operand(Smi::FromInt(num_parameters))); |
258 __ mov(r4, Operand(Smi::FromInt(rest_index))); | 268 __ mov(r4, Operand(Smi::FromInt(rest_index))); |
259 __ Push(r6, r5, r4); | 269 __ Push(r6, r5, r4); |
260 | 270 |
261 RestParamAccessStub stub(isolate()); | 271 RestParamAccessStub stub(isolate()); |
262 __ CallStub(&stub); | 272 __ CallStub(&stub); |
263 | 273 |
264 SetVar(rest_param, r3, r4, r5); | 274 SetVar(rest_param, r3, r4, r5); |
265 } | 275 } |
(...skipping 12 matching lines...) Expand all Loading... |
278 int num_parameters = info->scope()->num_parameters(); | 288 int num_parameters = info->scope()->num_parameters(); |
279 int offset = num_parameters * kPointerSize; | 289 int offset = num_parameters * kPointerSize; |
280 __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset)); | 290 __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset)); |
281 __ LoadSmiLiteral(r4, Smi::FromInt(num_parameters)); | 291 __ LoadSmiLiteral(r4, Smi::FromInt(num_parameters)); |
282 __ Push(r6, r5, r4); | 292 __ Push(r6, r5, r4); |
283 | 293 |
284 // Arguments to ArgumentsAccessStub: | 294 // Arguments to ArgumentsAccessStub: |
285 // function, receiver address, parameter count. | 295 // function, receiver address, parameter count. |
286 // The stub will rewrite receiever and parameter count if the previous | 296 // The stub will rewrite receiever and parameter count if the previous |
287 // stack frame was an arguments adapter frame. | 297 // stack frame was an arguments adapter frame. |
288 ArgumentsAccessStub::HasNewTarget has_new_target = | |
289 IsSubclassConstructor(info->function()->kind()) | |
290 ? ArgumentsAccessStub::HAS_NEW_TARGET | |
291 : ArgumentsAccessStub::NO_NEW_TARGET; | |
292 ArgumentsAccessStub::Type type; | 298 ArgumentsAccessStub::Type type; |
293 if (is_strict(language_mode()) || !is_simple_parameter_list()) { | 299 if (is_strict(language_mode()) || !is_simple_parameter_list()) { |
294 type = ArgumentsAccessStub::NEW_STRICT; | 300 type = ArgumentsAccessStub::NEW_STRICT; |
295 } else if (function()->has_duplicate_parameters()) { | 301 } else if (function()->has_duplicate_parameters()) { |
296 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 302 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
297 } else { | 303 } else { |
298 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 304 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
299 } | 305 } |
300 ArgumentsAccessStub stub(isolate(), type, has_new_target); | 306 ArgumentsAccessStub stub(isolate(), type, has_new_target); |
301 __ CallStub(&stub); | 307 __ CallStub(&stub); |
(...skipping 5146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5448 return ON_STACK_REPLACEMENT; | 5454 return ON_STACK_REPLACEMENT; |
5449 } | 5455 } |
5450 | 5456 |
5451 DCHECK(interrupt_address == | 5457 DCHECK(interrupt_address == |
5452 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5458 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5453 return OSR_AFTER_STACK_CHECK; | 5459 return OSR_AFTER_STACK_CHECK; |
5454 } | 5460 } |
5455 } | 5461 } |
5456 } // namespace v8::internal | 5462 } // namespace v8::internal |
5457 #endif // V8_TARGET_ARCH_PPC | 5463 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |