OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 // Push the return value on the stack as the parameter. | 315 // Push the return value on the stack as the parameter. |
316 // Runtime::TraceExit returns the parameter as it is. | 316 // Runtime::TraceExit returns the parameter as it is. |
317 frame_->EmitPush(r0); | 317 frame_->EmitPush(r0); |
318 frame_->CallRuntime(Runtime::kTraceExit, 1); | 318 frame_->CallRuntime(Runtime::kTraceExit, 1); |
319 } | 319 } |
320 | 320 |
321 // Add a label for checking the size of the code used for returning. | 321 // Add a label for checking the size of the code used for returning. |
322 Label check_exit_codesize; | 322 Label check_exit_codesize; |
323 masm_->bind(&check_exit_codesize); | 323 masm_->bind(&check_exit_codesize); |
324 | 324 |
| 325 // Calculate the exact length of the return sequence and make sure that |
| 326 // the constant pool is not emitted inside of the return sequence. |
| 327 int32_t sp_delta = (scope_->num_parameters() + 1) * kPointerSize; |
| 328 int return_sequence_length = Debug::kARMJSReturnSequenceLength; |
| 329 if (!masm_->ImmediateFitsAddrMode1Instruction(sp_delta)) { |
| 330 // Additional mov instruction generated. |
| 331 return_sequence_length++; |
| 332 } |
| 333 masm_->BlockConstPoolFor(return_sequence_length); |
| 334 |
325 // Tear down the frame which will restore the caller's frame pointer and | 335 // Tear down the frame which will restore the caller's frame pointer and |
326 // the link register. | 336 // the link register. |
327 frame_->Exit(); | 337 frame_->Exit(); |
328 | 338 |
329 // Here we use masm_-> instead of the __ macro to avoid the code coverage | 339 // Here we use masm_-> instead of the __ macro to avoid the code coverage |
330 // tool from instrumenting as we rely on the code size here. | 340 // tool from instrumenting as we rely on the code size here. |
331 int32_t sp_delta = (scope_->num_parameters() + 1) * kPointerSize; | |
332 masm_->add(sp, sp, Operand(sp_delta)); | 341 masm_->add(sp, sp, Operand(sp_delta)); |
333 masm_->Jump(lr); | 342 masm_->Jump(lr); |
334 | 343 |
335 // Check that the size of the code used for returning matches what is | 344 // Check that the size of the code used for returning matches what is |
336 // expected by the debugger. The add instruction above is an addressing | 345 // expected by the debugger. The add instruction above is an addressing |
337 // mode 1 instruction where there are restrictions on which immediate values | 346 // mode 1 instruction where there are restrictions on which immediate values |
338 // can be encoded in the instruction and which immediate values requires | 347 // can be encoded in the instruction and which immediate values requires |
339 // use of an additional instruction for moving the immediate to a temporary | 348 // use of an additional instruction for moving the immediate to a temporary |
340 // register. | 349 // register. |
341 #ifdef DEBUG | 350 ASSERT_EQ(return_sequence_length, |
342 int expected_return_sequence_length = kJSReturnSequenceLength; | |
343 if (!masm_->ImmediateFitsAddrMode1Instruction(sp_delta)) { | |
344 // Additional mov instruction generated. | |
345 expected_return_sequence_length++; | |
346 } | |
347 ASSERT_EQ(expected_return_sequence_length, | |
348 masm_->InstructionsGeneratedSince(&check_exit_codesize)); | 351 masm_->InstructionsGeneratedSince(&check_exit_codesize)); |
349 #endif | |
350 } | 352 } |
351 | 353 |
352 // Code generation state must be reset. | 354 // Code generation state must be reset. |
353 ASSERT(!has_cc()); | 355 ASSERT(!has_cc()); |
354 ASSERT(state_ == NULL); | 356 ASSERT(state_ == NULL); |
355 ASSERT(!function_return_is_shadowed_); | 357 ASSERT(!function_return_is_shadowed_); |
356 function_return_.Unuse(); | 358 function_return_.Unuse(); |
357 DeleteFrame(); | 359 DeleteFrame(); |
358 | 360 |
359 // Process any deferred code using the register allocator. | 361 // Process any deferred code using the register allocator. |
(...skipping 5871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6231 int CompareStub::MinorKey() { | 6233 int CompareStub::MinorKey() { |
6232 // Encode the two parameters in a unique 16 bit value. | 6234 // Encode the two parameters in a unique 16 bit value. |
6233 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); | 6235 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); |
6234 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); | 6236 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); |
6235 } | 6237 } |
6236 | 6238 |
6237 | 6239 |
6238 #undef __ | 6240 #undef __ |
6239 | 6241 |
6240 } } // namespace v8::internal | 6242 } } // namespace v8::internal |
OLD | NEW |