Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 16642003: add a default value for return value (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments addressed Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 int argc) { 462 int argc) {
463 // ----------- S t a t e ------------- 463 // ----------- S t a t e -------------
464 // -- esp[0] : return address 464 // -- esp[0] : return address
465 // -- esp[4] : object passing the type check 465 // -- esp[4] : object passing the type check
466 // (last fast api call extra argument, 466 // (last fast api call extra argument,
467 // set by CheckPrototypes) 467 // set by CheckPrototypes)
468 // -- esp[8] : api function 468 // -- esp[8] : api function
469 // (first fast api call extra argument) 469 // (first fast api call extra argument)
470 // -- esp[12] : api call data 470 // -- esp[12] : api call data
471 // -- esp[16] : isolate 471 // -- esp[16] : isolate
472 // -- esp[20] : ReturnValue 472 // -- esp[20] : ReturnValue default value
473 // -- esp[24] : last argument 473 // -- esp[24] : ReturnValue
474 // -- esp[28] : last argument
474 // -- ... 475 // -- ...
475 // -- esp[(argc + 5) * 4] : first argument 476 // -- esp[(argc + 6) * 4] : first argument
476 // -- esp[(argc + 6) * 4] : receiver 477 // -- esp[(argc + 7) * 4] : receiver
477 // ----------------------------------- 478 // -----------------------------------
478 // Get the function and setup the context. 479 // Get the function and setup the context.
479 Handle<JSFunction> function = optimization.constant_function(); 480 Handle<JSFunction> function = optimization.constant_function();
480 __ LoadHeapObject(edi, function); 481 __ LoadHeapObject(edi, function);
481 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 482 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
482 483
483 // Pass the additional arguments. 484 // Pass the additional arguments.
484 __ mov(Operand(esp, 2 * kPointerSize), edi); 485 __ mov(Operand(esp, 2 * kPointerSize), edi);
485 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 486 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
486 Handle<Object> call_data(api_call_info->data(), masm->isolate()); 487 Handle<Object> call_data(api_call_info->data(), masm->isolate());
487 if (masm->isolate()->heap()->InNewSpace(*call_data)) { 488 if (masm->isolate()->heap()->InNewSpace(*call_data)) {
488 __ mov(ecx, api_call_info); 489 __ mov(ecx, api_call_info);
489 __ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset)); 490 __ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset));
490 __ mov(Operand(esp, 3 * kPointerSize), ebx); 491 __ mov(Operand(esp, 3 * kPointerSize), ebx);
491 } else { 492 } else {
492 __ mov(Operand(esp, 3 * kPointerSize), Immediate(call_data)); 493 __ mov(Operand(esp, 3 * kPointerSize), Immediate(call_data));
493 } 494 }
494 __ mov(Operand(esp, 4 * kPointerSize), 495 __ mov(Operand(esp, 4 * kPointerSize),
495 Immediate(reinterpret_cast<int>(masm->isolate()))); 496 Immediate(reinterpret_cast<int>(masm->isolate())));
496 __ mov(Operand(esp, 5 * kPointerSize), 497 __ mov(Operand(esp, 5 * kPointerSize),
497 masm->isolate()->factory()->undefined_value()); 498 masm->isolate()->factory()->undefined_value());
499 __ mov(Operand(esp, 6 * kPointerSize),
500 masm->isolate()->factory()->undefined_value());
498 501
499 // Prepare arguments. 502 // Prepare arguments.
500 STATIC_ASSERT(kFastApiCallArguments == 5); 503 STATIC_ASSERT(kFastApiCallArguments == 6);
501 __ lea(eax, Operand(esp, kFastApiCallArguments * kPointerSize)); 504 __ lea(eax, Operand(esp, kFastApiCallArguments * kPointerSize));
502 505
503 const int kApiArgc = 1; // API function gets reference to the v8::Arguments. 506 const int kApiArgc = 1; // API function gets reference to the v8::Arguments.
504 507
505 // Allocate the v8::Arguments structure in the arguments' space since 508 // Allocate the v8::Arguments structure in the arguments' space since
506 // it's not controlled by GC. 509 // it's not controlled by GC.
507 const int kApiStackSpace = 4; 510 const int kApiStackSpace = 4;
508 511
509 // Function address is a foreign pointer outside V8's heap. 512 // Function address is a foreign pointer outside V8's heap.
510 Address function_address = v8::ToCData<Address>(api_call_info->callback()); 513 Address function_address = v8::ToCData<Address>(api_call_info->callback());
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 ASSERT(!scratch2().is(reg)); 1383 ASSERT(!scratch2().is(reg));
1381 __ push(reg); // holder 1384 __ push(reg); // holder
1382 // Push data from ExecutableAccessorInfo. 1385 // Push data from ExecutableAccessorInfo.
1383 if (isolate()->heap()->InNewSpace(callback->data())) { 1386 if (isolate()->heap()->InNewSpace(callback->data())) {
1384 __ mov(scratch1(), Immediate(callback)); 1387 __ mov(scratch1(), Immediate(callback));
1385 __ push(FieldOperand(scratch1(), ExecutableAccessorInfo::kDataOffset)); 1388 __ push(FieldOperand(scratch1(), ExecutableAccessorInfo::kDataOffset));
1386 } else { 1389 } else {
1387 __ push(Immediate(Handle<Object>(callback->data(), isolate()))); 1390 __ push(Immediate(Handle<Object>(callback->data(), isolate())));
1388 } 1391 }
1389 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue 1392 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue
1393 // ReturnValue default value
1394 __ push(Immediate(isolate()->factory()->undefined_value()));
1390 __ push(Immediate(reinterpret_cast<int>(isolate()))); 1395 __ push(Immediate(reinterpret_cast<int>(isolate())));
1391 1396
1392 // Save a pointer to where we pushed the arguments pointer. This will be 1397 // Save a pointer to where we pushed the arguments pointer. This will be
1393 // passed as the const ExecutableAccessorInfo& to the C++ callback. 1398 // passed as the const ExecutableAccessorInfo& to the C++ callback.
1394 __ push(scratch2()); 1399 __ push(scratch2());
1395 1400
1396 __ push(name()); // name 1401 __ push(name()); // name
1397 __ mov(ebx, esp); // esp points to reference to name (handler). 1402 __ mov(ebx, esp); // esp points to reference to name (handler).
1398 1403
1399 __ push(scratch3()); // Restore return address. 1404 __ push(scratch3()); // Restore return address.
(...skipping 13 matching lines...) Expand all
1413 __ mov(ApiParameterOperand(1, returns_handle), ebx); // arguments pointer. 1418 __ mov(ApiParameterOperand(1, returns_handle), ebx); // arguments pointer.
1414 1419
1415 // Emitting a stub call may try to allocate (if the code is not 1420 // Emitting a stub call may try to allocate (if the code is not
1416 // already generated). Do not allow the assembler to perform a 1421 // already generated). Do not allow the assembler to perform a
1417 // garbage collection but instead return the allocation failure 1422 // garbage collection but instead return the allocation failure
1418 // object. 1423 // object.
1419 1424
1420 __ CallApiFunctionAndReturn(getter_address, 1425 __ CallApiFunctionAndReturn(getter_address,
1421 kStackSpace, 1426 kStackSpace,
1422 returns_handle, 1427 returns_handle,
1423 5); 1428 6);
1424 } 1429 }
1425 1430
1426 1431
1427 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) { 1432 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<JSFunction> value) {
1428 // Return the constant value. 1433 // Return the constant value.
1429 __ LoadHeapObject(eax, value); 1434 __ LoadHeapObject(eax, value);
1430 __ ret(0); 1435 __ ret(0);
1431 } 1436 }
1432 1437
1433 1438
(...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after
3738 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3743 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3739 } 3744 }
3740 } 3745 }
3741 3746
3742 3747
3743 #undef __ 3748 #undef __
3744 3749
3745 } } // namespace v8::internal 3750 } } // namespace v8::internal
3746 3751
3747 #endif // V8_TARGET_ARCH_IA32 3752 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698