| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 6164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6175 break; | 6175 break; |
| 6176 case Token::BIT_NOT: | 6176 case Token::BIT_NOT: |
| 6177 __ InvokeBuiltin(Builtins::BIT_NOT, JUMP_JS); | 6177 __ InvokeBuiltin(Builtins::BIT_NOT, JUMP_JS); |
| 6178 break; | 6178 break; |
| 6179 default: | 6179 default: |
| 6180 UNREACHABLE(); | 6180 UNREACHABLE(); |
| 6181 } | 6181 } |
| 6182 } | 6182 } |
| 6183 | 6183 |
| 6184 | 6184 |
| 6185 int CEntryStub::MinorKey() { | |
| 6186 ASSERT(result_size_ <= 2); | |
| 6187 // Result returned in r0 or r0+r1 by default. | |
| 6188 return 0; | |
| 6189 } | |
| 6190 | |
| 6191 | |
| 6192 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { | 6185 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { |
| 6193 // r0 holds the exception. | 6186 // r0 holds the exception. |
| 6194 | 6187 |
| 6195 // Adjust this code if not the case. | 6188 // Adjust this code if not the case. |
| 6196 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 6189 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
| 6197 | 6190 |
| 6198 // Drop the sp to the top of the handler. | 6191 // Drop the sp to the top of the handler. |
| 6199 __ mov(r3, Operand(ExternalReference(Top::k_handler_address))); | 6192 __ mov(r3, Operand(ExternalReference(Top::k_handler_address))); |
| 6200 __ ldr(sp, MemOperand(r3)); | 6193 __ ldr(sp, MemOperand(r3)); |
| 6201 | 6194 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6289 #endif | 6282 #endif |
| 6290 ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); | 6283 ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize); |
| 6291 __ pop(pc); | 6284 __ pop(pc); |
| 6292 } | 6285 } |
| 6293 | 6286 |
| 6294 | 6287 |
| 6295 void CEntryStub::GenerateCore(MacroAssembler* masm, | 6288 void CEntryStub::GenerateCore(MacroAssembler* masm, |
| 6296 Label* throw_normal_exception, | 6289 Label* throw_normal_exception, |
| 6297 Label* throw_termination_exception, | 6290 Label* throw_termination_exception, |
| 6298 Label* throw_out_of_memory_exception, | 6291 Label* throw_out_of_memory_exception, |
| 6299 ExitFrame::Mode mode, | |
| 6300 bool do_gc, | 6292 bool do_gc, |
| 6301 bool always_allocate) { | 6293 bool always_allocate) { |
| 6302 // r0: result parameter for PerformGC, if any | 6294 // r0: result parameter for PerformGC, if any |
| 6303 // r4: number of arguments including receiver (C callee-saved) | 6295 // r4: number of arguments including receiver (C callee-saved) |
| 6304 // r5: pointer to builtin function (C callee-saved) | 6296 // r5: pointer to builtin function (C callee-saved) |
| 6305 // r6: pointer to the first argument (C callee-saved) | 6297 // r6: pointer to the first argument (C callee-saved) |
| 6306 | 6298 |
| 6307 if (do_gc) { | 6299 if (do_gc) { |
| 6308 // Passing r0. | 6300 // Passing r0. |
| 6309 ExternalReference gc_reference = ExternalReference::perform_gc_function(); | 6301 ExternalReference gc_reference = ExternalReference::perform_gc_function(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6349 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); | 6341 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |
| 6350 // Lower 2 bits of r2 are 0 iff r0 has failure tag. | 6342 // Lower 2 bits of r2 are 0 iff r0 has failure tag. |
| 6351 __ add(r2, r0, Operand(1)); | 6343 __ add(r2, r0, Operand(1)); |
| 6352 __ tst(r2, Operand(kFailureTagMask)); | 6344 __ tst(r2, Operand(kFailureTagMask)); |
| 6353 __ b(eq, &failure_returned); | 6345 __ b(eq, &failure_returned); |
| 6354 | 6346 |
| 6355 // Exit C frame and return. | 6347 // Exit C frame and return. |
| 6356 // r0:r1: result | 6348 // r0:r1: result |
| 6357 // sp: stack pointer | 6349 // sp: stack pointer |
| 6358 // fp: frame pointer | 6350 // fp: frame pointer |
| 6359 __ LeaveExitFrame(mode); | 6351 __ LeaveExitFrame(mode_); |
| 6360 | 6352 |
| 6361 // check if we should retry or throw exception | 6353 // check if we should retry or throw exception |
| 6362 Label retry; | 6354 Label retry; |
| 6363 __ bind(&failure_returned); | 6355 __ bind(&failure_returned); |
| 6364 ASSERT(Failure::RETRY_AFTER_GC == 0); | 6356 ASSERT(Failure::RETRY_AFTER_GC == 0); |
| 6365 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 6357 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
| 6366 __ b(eq, &retry); | 6358 __ b(eq, &retry); |
| 6367 | 6359 |
| 6368 // Special handling of out of memory exceptions. | 6360 // Special handling of out of memory exceptions. |
| 6369 Failure* out_of_memory = Failure::OutOfMemoryException(); | 6361 Failure* out_of_memory = Failure::OutOfMemoryException(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6382 __ cmp(r0, Operand(Factory::termination_exception())); | 6374 __ cmp(r0, Operand(Factory::termination_exception())); |
| 6383 __ b(eq, throw_termination_exception); | 6375 __ b(eq, throw_termination_exception); |
| 6384 | 6376 |
| 6385 // Handle normal exception. | 6377 // Handle normal exception. |
| 6386 __ jmp(throw_normal_exception); | 6378 __ jmp(throw_normal_exception); |
| 6387 | 6379 |
| 6388 __ bind(&retry); // pass last failure (r0) as parameter (r0) when retrying | 6380 __ bind(&retry); // pass last failure (r0) as parameter (r0) when retrying |
| 6389 } | 6381 } |
| 6390 | 6382 |
| 6391 | 6383 |
| 6392 void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { | 6384 void CEntryStub::Generate(MacroAssembler* masm) { |
| 6393 // Called from JavaScript; parameters are on stack as if calling JS function | 6385 // Called from JavaScript; parameters are on stack as if calling JS function |
| 6394 // r0: number of arguments including receiver | 6386 // r0: number of arguments including receiver |
| 6395 // r1: pointer to builtin function | 6387 // r1: pointer to builtin function |
| 6396 // fp: frame pointer (restored after C call) | 6388 // fp: frame pointer (restored after C call) |
| 6397 // sp: stack pointer (restored as callee's sp after C call) | 6389 // sp: stack pointer (restored as callee's sp after C call) |
| 6398 // cp: current context (C callee-saved) | 6390 // cp: current context (C callee-saved) |
| 6399 | 6391 |
| 6392 // Result returned in r0 or r0+r1 by default. |
| 6393 |
| 6400 // NOTE: Invocations of builtins may return failure objects | 6394 // NOTE: Invocations of builtins may return failure objects |
| 6401 // instead of a proper result. The builtin entry handles | 6395 // instead of a proper result. The builtin entry handles |
| 6402 // this by performing a garbage collection and retrying the | 6396 // this by performing a garbage collection and retrying the |
| 6403 // builtin once. | 6397 // builtin once. |
| 6404 | 6398 |
| 6405 ExitFrame::Mode mode = is_debug_break | |
| 6406 ? ExitFrame::MODE_DEBUG | |
| 6407 : ExitFrame::MODE_NORMAL; | |
| 6408 | |
| 6409 // Enter the exit frame that transitions from JavaScript to C++. | 6399 // Enter the exit frame that transitions from JavaScript to C++. |
| 6410 __ EnterExitFrame(mode); | 6400 __ EnterExitFrame(mode_); |
| 6411 | 6401 |
| 6412 // r4: number of arguments (C callee-saved) | 6402 // r4: number of arguments (C callee-saved) |
| 6413 // r5: pointer to builtin function (C callee-saved) | 6403 // r5: pointer to builtin function (C callee-saved) |
| 6414 // r6: pointer to first argument (C callee-saved) | 6404 // r6: pointer to first argument (C callee-saved) |
| 6415 | 6405 |
| 6416 Label throw_normal_exception; | 6406 Label throw_normal_exception; |
| 6417 Label throw_termination_exception; | 6407 Label throw_termination_exception; |
| 6418 Label throw_out_of_memory_exception; | 6408 Label throw_out_of_memory_exception; |
| 6419 | 6409 |
| 6420 // Call into the runtime system. | 6410 // Call into the runtime system. |
| 6421 GenerateCore(masm, | 6411 GenerateCore(masm, |
| 6422 &throw_normal_exception, | 6412 &throw_normal_exception, |
| 6423 &throw_termination_exception, | 6413 &throw_termination_exception, |
| 6424 &throw_out_of_memory_exception, | 6414 &throw_out_of_memory_exception, |
| 6425 mode, | |
| 6426 false, | 6415 false, |
| 6427 false); | 6416 false); |
| 6428 | 6417 |
| 6429 // Do space-specific GC and retry runtime call. | 6418 // Do space-specific GC and retry runtime call. |
| 6430 GenerateCore(masm, | 6419 GenerateCore(masm, |
| 6431 &throw_normal_exception, | 6420 &throw_normal_exception, |
| 6432 &throw_termination_exception, | 6421 &throw_termination_exception, |
| 6433 &throw_out_of_memory_exception, | 6422 &throw_out_of_memory_exception, |
| 6434 mode, | |
| 6435 true, | 6423 true, |
| 6436 false); | 6424 false); |
| 6437 | 6425 |
| 6438 // Do full GC and retry runtime call one final time. | 6426 // Do full GC and retry runtime call one final time. |
| 6439 Failure* failure = Failure::InternalError(); | 6427 Failure* failure = Failure::InternalError(); |
| 6440 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); | 6428 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); |
| 6441 GenerateCore(masm, | 6429 GenerateCore(masm, |
| 6442 &throw_normal_exception, | 6430 &throw_normal_exception, |
| 6443 &throw_termination_exception, | 6431 &throw_termination_exception, |
| 6444 &throw_out_of_memory_exception, | 6432 &throw_out_of_memory_exception, |
| 6445 mode, | |
| 6446 true, | 6433 true, |
| 6447 true); | 6434 true); |
| 6448 | 6435 |
| 6449 __ bind(&throw_out_of_memory_exception); | 6436 __ bind(&throw_out_of_memory_exception); |
| 6450 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); | 6437 GenerateThrowUncatchable(masm, OUT_OF_MEMORY); |
| 6451 | 6438 |
| 6452 __ bind(&throw_termination_exception); | 6439 __ bind(&throw_termination_exception); |
| 6453 GenerateThrowUncatchable(masm, TERMINATION); | 6440 GenerateThrowUncatchable(masm, TERMINATION); |
| 6454 | 6441 |
| 6455 __ bind(&throw_normal_exception); | 6442 __ bind(&throw_normal_exception); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6926 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 6913 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
| 6927 // tagged as a small integer. | 6914 // tagged as a small integer. |
| 6928 __ bind(&runtime); | 6915 __ bind(&runtime); |
| 6929 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); | 6916 __ TailCallRuntime(ExternalReference(Runtime::kStringCompare), 2, 1); |
| 6930 } | 6917 } |
| 6931 | 6918 |
| 6932 | 6919 |
| 6933 #undef __ | 6920 #undef __ |
| 6934 | 6921 |
| 6935 } } // namespace v8::internal | 6922 } } // namespace v8::internal |
| OLD | NEW |