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

Side by Side Diff: src/a64/full-codegen-a64.cc

Issue 153953005: A64: Synchronize with r16993. (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/a64/builtins-a64.cc ('k') | src/a64/lithium-a64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 4925 matching lines...) Expand 10 before | Expand all | Expand 10 after
4936 // Uncook the return address (see EnterFinallyBlock). 4936 // Uncook the return address (see EnterFinallyBlock).
4937 __ SmiUntag(x10); 4937 __ SmiUntag(x10);
4938 __ Add(x11, x10, Operand(masm_->CodeObject())); 4938 __ Add(x11, x10, Operand(masm_->CodeObject()));
4939 __ Br(x11); 4939 __ Br(x11);
4940 } 4940 }
4941 4941
4942 4942
4943 #undef __ 4943 #undef __
4944 4944
4945 4945
4946 // The back edge bookkeeping code matches the pattern:
4947 //
4948 // <decrement profiling counter>
4949 // .. .. .. .. b.pl ok
4950 // .. .. .. .. ldr x16, pc+<interrupt stub address>
4951 // .. .. .. .. blr x16
4952 // ok-label
4953 //
4954 // We patch the code to the following form:
4955 //
4956 // <decrement profiling counter>
4957 // .. .. .. .. mov x0, x0 (NOP)
4958 // .. .. .. .. ldr x16, pc+<on-stack replacement address>
4959 // .. .. .. .. blr x16
4960 void BackEdgeTable::PatchAt(Code* unoptimized_code, 4946 void BackEdgeTable::PatchAt(Code* unoptimized_code,
4961 Address pc_after, 4947 Address pc,
4948 BackEdgeState target_state,
4962 Code* replacement_code) { 4949 Code* replacement_code) {
4963 // Turn the jump into a nop. 4950 // Turn the jump into a nop.
4964 Instruction* jump = Instruction::Cast(pc_after)->preceding(3); 4951 Address branch_address = pc - 3 * kInstructionSize;
4965 PatchingAssembler patcher(jump, 1); 4952 PatchingAssembler patcher(branch_address, 1);
4966 patcher.nop(Assembler::INTERRUPT_CODE_NOP); 4953
4954 switch (target_state) {
4955 case INTERRUPT:
4956 // <decrement profiling counter>
4957 // .. .. .. .. b.pl ok
4958 // .. .. .. .. ldr x16, pc+<interrupt stub address>
4959 // .. .. .. .. blr x16
4960 // ok-label
4961 // Jump offset is 4 instructions.
4962 patcher.b(4 * kInstructionSize, pl);
4963 break;
4964 case ON_STACK_REPLACEMENT:
4965 case OSR_AFTER_STACK_CHECK:
4966 // <decrement profiling counter>
4967 // .. .. .. .. mov x0, x0 (NOP)
4968 // .. .. .. .. ldr x16, pc+<on-stack replacement address>
4969 // .. .. .. .. blr x16
4970 patcher.nop(Assembler::INTERRUPT_CODE_NOP);
4971 break;
4972 }
4967 4973
4968 // Replace the call address. 4974 // Replace the call address.
4969 Instruction* load = Instruction::Cast(pc_after)->preceding(2); 4975 Instruction* load = Instruction::Cast(pc)->preceding(2);
4970 Address interrupt_address_pointer = 4976 Address interrupt_address_pointer = pc + load->ImmPCOffset();
4971 reinterpret_cast<Address>(load) + load->ImmPCOffset();
4972 Memory::uint64_at(interrupt_address_pointer) = 4977 Memory::uint64_at(interrupt_address_pointer) =
4973 reinterpret_cast<uint64_t>(replacement_code->entry()); 4978 reinterpret_cast<uint64_t>(replacement_code->entry());
4974 4979
4975 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( 4980 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
4976 unoptimized_code, pc_after - 2 * kInstructionSize, replacement_code); 4981 unoptimized_code, reinterpret_cast<Address>(load), replacement_code);
4977 } 4982 }
4978 4983
4979 4984
4980 void BackEdgeTable::RevertAt(Code* unoptimized_code, 4985 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState(
4981 Address pc_after, 4986 Isolate* isolate,
4982 Code* interrupt_code) { 4987 Code* unoptimized_code,
4983 // Turn the nop into a jump. 4988 Address pc) {
4984 Instruction* jump = Instruction::Cast(pc_after)->preceding(3); 4989 // TODO(jbramley): There should be some extra assertions here (as in the ARM
4985 PatchingAssembler patcher(jump, 1); 4990 // back-end), but this function is gone in bleeding_edge so it might not
4986 patcher.b(6, pl); // The ok label is 6 instructions later. 4991 // matter anyway.
4992 Instruction* jump_or_nop = Instruction::Cast(pc)->preceding(3);
4987 4993
4988 // Replace the call address. 4994 if (jump_or_nop->IsNop(Assembler::INTERRUPT_CODE_NOP)) {
4989 Instruction* load = Instruction::Cast(pc_after)->preceding(2); 4995 Instruction* load = Instruction::Cast(pc)->preceding(2);
4990 Address interrupt_address_pointer = 4996 uint64_t entry = Memory::uint64_at(pc + load->ImmPCOffset());
4991 reinterpret_cast<Address>(load) + load->ImmPCOffset(); 4997 if (entry == reinterpret_cast<uint64_t>(
4992 Memory::uint64_at(interrupt_address_pointer) = 4998 isolate->builtins()->OnStackReplacement()->entry())) {
4993 reinterpret_cast<uint64_t>(interrupt_code->entry()); 4999 return ON_STACK_REPLACEMENT;
5000 } else if (entry == reinterpret_cast<uint64_t>(
5001 isolate->builtins()->OsrAfterStackCheck()->entry())) {
5002 return OSR_AFTER_STACK_CHECK;
5003 } else {
5004 UNREACHABLE();
5005 }
5006 }
4994 5007
4995 interrupt_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( 5008 return INTERRUPT;
4996 unoptimized_code, pc_after - 2 * kInstructionSize, interrupt_code);
4997 } 5009 }
4998 5010
4999 5011
5000 #ifdef DEBUG
5001 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState(
5002 Isolate* isolate,
5003 Code* unoptimized_code,
5004 Address pc_after) {
5005 // TODO(jbramley): There should be some extra assertions here (as in the ARM
5006 // back-end), but this function is gone in bleeding_edge so it might not
5007 // matter anyway.
5008 Instruction* jump_or_nop = Instruction::Cast(pc_after)->preceding(3);
5009 return jump_or_nop->IsNop(Assembler::INTERRUPT_CODE_NOP) ?
5010 ON_STACK_REPLACEMENT : INTERRUPT;
5011 }
5012 #endif
5013
5014
5015 #define __ ACCESS_MASM(masm()) 5012 #define __ ACCESS_MASM(masm())
5016 5013
5017 5014
5018 FullCodeGenerator::NestedStatement* FullCodeGenerator::TryFinally::Exit( 5015 FullCodeGenerator::NestedStatement* FullCodeGenerator::TryFinally::Exit(
5019 int* stack_depth, 5016 int* stack_depth,
5020 int* context_length) { 5017 int* context_length) {
5021 ASM_LOCATION("FullCodeGenerator::TryFinally::Exit"); 5018 ASM_LOCATION("FullCodeGenerator::TryFinally::Exit");
5022 // The macros used here must preserve the result register. 5019 // The macros used here must preserve the result register.
5023 5020
5024 // Because the handler block contains the context of the finally 5021 // Because the handler block contains the context of the finally
(...skipping 14 matching lines...) Expand all
5039 return previous_; 5036 return previous_;
5040 } 5037 }
5041 5038
5042 5039
5043 #undef __ 5040 #undef __
5044 5041
5045 5042
5046 } } // namespace v8::internal 5043 } } // namespace v8::internal
5047 5044
5048 #endif // V8_TARGET_ARCH_A64 5045 #endif // V8_TARGET_ARCH_A64
OLDNEW
« no previous file with comments | « src/a64/builtins-a64.cc ('k') | src/a64/lithium-a64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698