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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 157543002: A64: Synchronize with r18581. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/ia32/builtins-ia32.cc ('k') | src/ia32/codegen-ia32.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 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 __ bind(&done); 2510 __ bind(&done);
2511 } 2511 }
2512 2512
2513 2513
2514 void CallFunctionStub::Generate(MacroAssembler* masm) { 2514 void CallFunctionStub::Generate(MacroAssembler* masm) {
2515 // ebx : cache cell for call target 2515 // ebx : cache cell for call target
2516 // edi : the function to call 2516 // edi : the function to call
2517 Isolate* isolate = masm->isolate(); 2517 Isolate* isolate = masm->isolate();
2518 Label slow, non_function; 2518 Label slow, non_function;
2519 2519
2520 // The receiver might implicitly be the global object. This is
2521 // indicated by passing the hole as the receiver to the call
2522 // function stub.
2523 if (ReceiverMightBeImplicit()) {
2524 Label receiver_ok;
2525 // Get the receiver from the stack.
2526 // +1 ~ return address
2527 __ mov(eax, Operand(esp, (argc_ + 1) * kPointerSize));
2528 // Call as function is indicated with the hole.
2529 __ cmp(eax, isolate->factory()->the_hole_value());
2530 __ j(not_equal, &receiver_ok, Label::kNear);
2531 // Patch the receiver on the stack with the global receiver object.
2532 __ mov(ecx, GlobalObjectOperand());
2533 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset));
2534 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), ecx);
2535 __ bind(&receiver_ok);
2536 }
2537
2538 // Check that the function really is a JavaScript function. 2520 // Check that the function really is a JavaScript function.
2539 __ JumpIfSmi(edi, &non_function); 2521 __ JumpIfSmi(edi, &non_function);
2522
2540 // Goto slow case if we do not have a function. 2523 // Goto slow case if we do not have a function.
2541 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 2524 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
2542 __ j(not_equal, &slow); 2525 __ j(not_equal, &slow);
2543 2526
2544 if (RecordCallTarget()) { 2527 if (RecordCallTarget()) {
2545 GenerateRecordCallTarget(masm); 2528 GenerateRecordCallTarget(masm);
2546 } 2529 }
2547 2530
2548 // Fast-case: Just invoke the function. 2531 // Fast-case: Just invoke the function.
2549 ParameterCount actual(argc_); 2532 ParameterCount actual(argc_);
2550 2533
2551 if (ReceiverMightBeImplicit()) {
2552 Label call_as_function;
2553 __ cmp(eax, isolate->factory()->the_hole_value());
2554 __ j(equal, &call_as_function);
2555 __ InvokeFunction(edi,
2556 actual,
2557 JUMP_FUNCTION,
2558 NullCallWrapper(),
2559 CALL_AS_METHOD);
2560 __ bind(&call_as_function);
2561 }
2562 __ InvokeFunction(edi, 2534 __ InvokeFunction(edi,
2563 actual, 2535 actual,
2564 JUMP_FUNCTION, 2536 JUMP_FUNCTION,
2565 NullCallWrapper(), 2537 NullCallWrapper(),
2566 CALL_AS_FUNCTION); 2538 CALL_AS_FUNCTION);
2567 2539
2568 // Slow-case: Non-function called. 2540 // Slow-case: Non-function called.
2569 __ bind(&slow); 2541 __ bind(&slow);
2570 if (RecordCallTarget()) { 2542 if (RecordCallTarget()) {
2571 // If there is a call target cache, mark it megamorphic in the 2543 // If there is a call target cache, mark it megamorphic in the
(...skipping 16 matching lines...) Expand all
2588 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); 2560 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline();
2589 __ jmp(adaptor, RelocInfo::CODE_TARGET); 2561 __ jmp(adaptor, RelocInfo::CODE_TARGET);
2590 } 2562 }
2591 2563
2592 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 2564 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
2593 // of the original receiver from the call site). 2565 // of the original receiver from the call site).
2594 __ bind(&non_function); 2566 __ bind(&non_function);
2595 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi); 2567 __ mov(Operand(esp, (argc_ + 1) * kPointerSize), edi);
2596 __ Set(eax, Immediate(argc_)); 2568 __ Set(eax, Immediate(argc_));
2597 __ Set(ebx, Immediate(0)); 2569 __ Set(ebx, Immediate(0));
2598 __ SetCallKind(ecx, CALL_AS_METHOD); 2570 __ SetCallKind(ecx, CALL_AS_FUNCTION);
2599 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION); 2571 __ GetBuiltinEntry(edx, Builtins::CALL_NON_FUNCTION);
2600 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline(); 2572 Handle<Code> adaptor = isolate->builtins()->ArgumentsAdaptorTrampoline();
2601 __ jmp(adaptor, RelocInfo::CODE_TARGET); 2573 __ jmp(adaptor, RelocInfo::CODE_TARGET);
2602 } 2574 }
2603 2575
2604 2576
2605 void CallConstructStub::Generate(MacroAssembler* masm) { 2577 void CallConstructStub::Generate(MacroAssembler* masm) {
2606 // eax : number of arguments 2578 // eax : number of arguments
2607 // ebx : cache cell for call target 2579 // ebx : cache cell for call target
2608 // edi : constructor function 2580 // edi : constructor function
(...skipping 2776 matching lines...) Expand 10 before | Expand all | Expand 10 after
5385 5357
5386 __ ret(0); 5358 __ ret(0);
5387 } 5359 }
5388 5360
5389 5361
5390 template<class T> 5362 template<class T>
5391 static void CreateArrayDispatch(MacroAssembler* masm, 5363 static void CreateArrayDispatch(MacroAssembler* masm,
5392 AllocationSiteOverrideMode mode) { 5364 AllocationSiteOverrideMode mode) {
5393 if (mode == DISABLE_ALLOCATION_SITES) { 5365 if (mode == DISABLE_ALLOCATION_SITES) {
5394 T stub(GetInitialFastElementsKind(), 5366 T stub(GetInitialFastElementsKind(),
5395 CONTEXT_CHECK_REQUIRED,
5396 mode); 5367 mode);
5397 __ TailCallStub(&stub); 5368 __ TailCallStub(&stub);
5398 } else if (mode == DONT_OVERRIDE) { 5369 } else if (mode == DONT_OVERRIDE) {
5399 int last_index = GetSequenceIndexFromFastElementsKind( 5370 int last_index = GetSequenceIndexFromFastElementsKind(
5400 TERMINAL_FAST_ELEMENTS_KIND); 5371 TERMINAL_FAST_ELEMENTS_KIND);
5401 for (int i = 0; i <= last_index; ++i) { 5372 for (int i = 0; i <= last_index; ++i) {
5402 Label next; 5373 Label next;
5403 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5374 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5404 __ cmp(edx, kind); 5375 __ cmp(edx, kind);
5405 __ j(not_equal, &next); 5376 __ j(not_equal, &next);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5441 // look at the first argument 5412 // look at the first argument
5442 __ mov(ecx, Operand(esp, kPointerSize)); 5413 __ mov(ecx, Operand(esp, kPointerSize));
5443 __ test(ecx, ecx); 5414 __ test(ecx, ecx);
5444 __ j(zero, &normal_sequence); 5415 __ j(zero, &normal_sequence);
5445 5416
5446 if (mode == DISABLE_ALLOCATION_SITES) { 5417 if (mode == DISABLE_ALLOCATION_SITES) {
5447 ElementsKind initial = GetInitialFastElementsKind(); 5418 ElementsKind initial = GetInitialFastElementsKind();
5448 ElementsKind holey_initial = GetHoleyElementsKind(initial); 5419 ElementsKind holey_initial = GetHoleyElementsKind(initial);
5449 5420
5450 ArraySingleArgumentConstructorStub stub_holey(holey_initial, 5421 ArraySingleArgumentConstructorStub stub_holey(holey_initial,
5451 CONTEXT_CHECK_REQUIRED,
5452 DISABLE_ALLOCATION_SITES); 5422 DISABLE_ALLOCATION_SITES);
5453 __ TailCallStub(&stub_holey); 5423 __ TailCallStub(&stub_holey);
5454 5424
5455 __ bind(&normal_sequence); 5425 __ bind(&normal_sequence);
5456 ArraySingleArgumentConstructorStub stub(initial, 5426 ArraySingleArgumentConstructorStub stub(initial,
5457 CONTEXT_CHECK_REQUIRED,
5458 DISABLE_ALLOCATION_SITES); 5427 DISABLE_ALLOCATION_SITES);
5459 __ TailCallStub(&stub); 5428 __ TailCallStub(&stub);
5460 } else if (mode == DONT_OVERRIDE) { 5429 } else if (mode == DONT_OVERRIDE) {
5461 // We are going to create a holey array, but our kind is non-holey. 5430 // We are going to create a holey array, but our kind is non-holey.
5462 // Fix kind and retry. 5431 // Fix kind and retry.
5463 __ inc(edx); 5432 __ inc(edx);
5464 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset)); 5433 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset));
5465 if (FLAG_debug_code) { 5434 if (FLAG_debug_code) {
5466 Handle<Map> allocation_site_map = 5435 Handle<Map> allocation_site_map =
5467 masm->isolate()->factory()->allocation_site_map(); 5436 masm->isolate()->factory()->allocation_site_map();
(...skipping 24 matching lines...) Expand all
5492 // If we reached this point there is a problem. 5461 // If we reached this point there is a problem.
5493 __ Abort(kUnexpectedElementsKindInArrayConstructor); 5462 __ Abort(kUnexpectedElementsKindInArrayConstructor);
5494 } else { 5463 } else {
5495 UNREACHABLE(); 5464 UNREACHABLE();
5496 } 5465 }
5497 } 5466 }
5498 5467
5499 5468
5500 template<class T> 5469 template<class T>
5501 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { 5470 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) {
5502 ElementsKind initial_kind = GetInitialFastElementsKind();
5503 ElementsKind initial_holey_kind = GetHoleyElementsKind(initial_kind);
5504
5505 int to_index = GetSequenceIndexFromFastElementsKind( 5471 int to_index = GetSequenceIndexFromFastElementsKind(
5506 TERMINAL_FAST_ELEMENTS_KIND); 5472 TERMINAL_FAST_ELEMENTS_KIND);
5507 for (int i = 0; i <= to_index; ++i) { 5473 for (int i = 0; i <= to_index; ++i) {
5508 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5474 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5509 T stub(kind); 5475 T stub(kind);
5510 stub.GetCode(isolate); 5476 stub.GetCode(isolate);
5511 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE || 5477 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) {
5512 (!FLAG_track_allocation_sites && 5478 T stub1(kind, DISABLE_ALLOCATION_SITES);
5513 (kind == initial_kind || kind == initial_holey_kind))) {
5514 T stub1(kind, CONTEXT_CHECK_REQUIRED, DISABLE_ALLOCATION_SITES);
5515 stub1.GetCode(isolate); 5479 stub1.GetCode(isolate);
5516 } 5480 }
5517 } 5481 }
5518 } 5482 }
5519 5483
5520 5484
5521 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { 5485 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) {
5522 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( 5486 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
5523 isolate); 5487 isolate);
5524 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( 5488 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
5713 __ bind(&fast_elements_case); 5677 __ bind(&fast_elements_case);
5714 GenerateCase(masm, FAST_ELEMENTS); 5678 GenerateCase(masm, FAST_ELEMENTS);
5715 } 5679 }
5716 5680
5717 5681
5718 #undef __ 5682 #undef __
5719 5683
5720 } } // namespace v8::internal 5684 } } // namespace v8::internal
5721 5685
5722 #endif // V8_TARGET_ARCH_IA32 5686 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698