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 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 EmitReturnSequence(); | 310 EmitReturnSequence(); |
311 } | 311 } |
312 } | 312 } |
313 | 313 |
314 | 314 |
315 void FullCodeGenerator::ClearAccumulator() { | 315 void FullCodeGenerator::ClearAccumulator() { |
316 __ Set(rax, 0); | 316 __ Set(rax, 0); |
317 } | 317 } |
318 | 318 |
319 | 319 |
320 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) { | 320 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, |
| 321 Label* back_edge_target) { |
321 Comment cmnt(masm_, "[ Stack check"); | 322 Comment cmnt(masm_, "[ Stack check"); |
322 Label ok; | 323 Label ok; |
323 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | 324 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
324 __ j(above_equal, &ok, Label::kNear); | 325 __ j(above_equal, &ok, Label::kNear); |
325 StackCheckStub stub; | 326 StackCheckStub stub; |
326 __ CallStub(&stub); | 327 __ CallStub(&stub); |
327 // Record a mapping of this PC offset to the OSR id. This is used to find | 328 // Record a mapping of this PC offset to the OSR id. This is used to find |
328 // the AST id from the unoptimized code in order to use it as a key into | 329 // the AST id from the unoptimized code in order to use it as a key into |
329 // the deoptimization input data found in the optimized code. | 330 // the deoptimization input data found in the optimized code. |
330 RecordStackCheck(stmt->OsrEntryId()); | 331 RecordStackCheck(stmt->OsrEntryId()); |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 } | 1065 } |
1065 | 1066 |
1066 // Generate code for the body of the loop. | 1067 // Generate code for the body of the loop. |
1067 Visit(stmt->body()); | 1068 Visit(stmt->body()); |
1068 | 1069 |
1069 // Generate code for going to the next element by incrementing the | 1070 // Generate code for going to the next element by incrementing the |
1070 // index (smi) stored on top of the stack. | 1071 // index (smi) stored on top of the stack. |
1071 __ bind(loop_statement.continue_label()); | 1072 __ bind(loop_statement.continue_label()); |
1072 __ SmiAddConstant(Operand(rsp, 0 * kPointerSize), Smi::FromInt(1)); | 1073 __ SmiAddConstant(Operand(rsp, 0 * kPointerSize), Smi::FromInt(1)); |
1073 | 1074 |
1074 EmitStackCheck(stmt); | 1075 EmitStackCheck(stmt, &loop); |
1075 __ jmp(&loop); | 1076 __ jmp(&loop); |
1076 | 1077 |
1077 // Remove the pointers stored on the stack. | 1078 // Remove the pointers stored on the stack. |
1078 __ bind(loop_statement.break_label()); | 1079 __ bind(loop_statement.break_label()); |
1079 __ addq(rsp, Immediate(5 * kPointerSize)); | 1080 __ addq(rsp, Immediate(5 * kPointerSize)); |
1080 | 1081 |
1081 // Exit and decrement the loop depth. | 1082 // Exit and decrement the loop depth. |
1082 __ bind(&exit); | 1083 __ bind(&exit); |
1083 decrement_loop_depth(); | 1084 decrement_loop_depth(); |
1084 } | 1085 } |
(...skipping 3297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4382 *context_length = 0; | 4383 *context_length = 0; |
4383 return previous_; | 4384 return previous_; |
4384 } | 4385 } |
4385 | 4386 |
4386 | 4387 |
4387 #undef __ | 4388 #undef __ |
4388 | 4389 |
4389 } } // namespace v8::internal | 4390 } } // namespace v8::internal |
4390 | 4391 |
4391 #endif // V8_TARGET_ARCH_X64 | 4392 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |