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

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

Issue 146213004: A64: Synchronize with r16849. (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/x64/deoptimizer-x64.cc ('k') | src/x64/lithium-codegen-x64.h » ('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 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 Comment cmnt(masm_, "[ ObjectLiteral"); 1602 Comment cmnt(masm_, "[ ObjectLiteral");
1603 Handle<FixedArray> constant_properties = expr->constant_properties(); 1603 Handle<FixedArray> constant_properties = expr->constant_properties();
1604 int flags = expr->fast_elements() 1604 int flags = expr->fast_elements()
1605 ? ObjectLiteral::kFastElements 1605 ? ObjectLiteral::kFastElements
1606 : ObjectLiteral::kNoFlags; 1606 : ObjectLiteral::kNoFlags;
1607 flags |= expr->has_function() 1607 flags |= expr->has_function()
1608 ? ObjectLiteral::kHasFunction 1608 ? ObjectLiteral::kHasFunction
1609 : ObjectLiteral::kNoFlags; 1609 : ObjectLiteral::kNoFlags;
1610 int properties_count = constant_properties->length() / 2; 1610 int properties_count = constant_properties->length() / 2;
1611 if ((FLAG_track_double_fields && expr->may_store_doubles()) || 1611 if ((FLAG_track_double_fields && expr->may_store_doubles()) ||
1612 expr->depth() > 1) { 1612 expr->depth() > 1 || Serializer::enabled() ||
1613 flags != ObjectLiteral::kFastElements ||
1614 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1613 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1615 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1614 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); 1616 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset));
1615 __ Push(Smi::FromInt(expr->literal_index())); 1617 __ Push(Smi::FromInt(expr->literal_index()));
1616 __ Push(constant_properties); 1618 __ Push(constant_properties);
1617 __ Push(Smi::FromInt(flags)); 1619 __ Push(Smi::FromInt(flags));
1618 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); 1620 __ CallRuntime(Runtime::kCreateObjectLiteral, 4);
1619 } else if (Serializer::enabled() || flags != ObjectLiteral::kFastElements ||
1620 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
1621 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1622 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset));
1623 __ Push(Smi::FromInt(expr->literal_index()));
1624 __ Push(constant_properties);
1625 __ Push(Smi::FromInt(flags));
1626 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4);
1627 } else { 1621 } else {
1628 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1622 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1629 __ movq(rax, FieldOperand(rdi, JSFunction::kLiteralsOffset)); 1623 __ movq(rax, FieldOperand(rdi, JSFunction::kLiteralsOffset));
1630 __ Move(rbx, Smi::FromInt(expr->literal_index())); 1624 __ Move(rbx, Smi::FromInt(expr->literal_index()));
1631 __ Move(rcx, constant_properties); 1625 __ Move(rcx, constant_properties);
1632 __ Move(rdx, Smi::FromInt(flags)); 1626 __ Move(rdx, Smi::FromInt(flags));
1633 FastCloneShallowObjectStub stub(properties_count); 1627 FastCloneShallowObjectStub stub(properties_count);
1634 __ CallStub(&stub); 1628 __ CallStub(&stub);
1635 } 1629 }
1636 1630
(...skipping 3239 matching lines...) Expand 10 before | Expand all | Expand 10 after
4876 __ call(finally_entry_); 4870 __ call(finally_entry_);
4877 4871
4878 *stack_depth = 0; 4872 *stack_depth = 0;
4879 *context_length = 0; 4873 *context_length = 0;
4880 return previous_; 4874 return previous_;
4881 } 4875 }
4882 4876
4883 4877
4884 #undef __ 4878 #undef __
4885 4879
4880
4881 static const byte kJnsInstruction = 0x79;
4882 static const byte kJnsOffset = 0x1d;
4883 static const byte kCallInstruction = 0xe8;
4884 static const byte kNopByteOne = 0x66;
4885 static const byte kNopByteTwo = 0x90;
4886
4887 // The back edge bookkeeping code matches the pattern:
4888 //
4889 // add <profiling_counter>, <-delta>
4890 // jns ok
4891 // call <stack guard>
4892 // ok:
4893 //
4894 // We will patch away the branch so the code is:
4895 //
4896 // add <profiling_counter>, <-delta> ;; Not changed
4897 // nop
4898 // nop
4899 // call <on-stack replacment>
4900 // ok:
4901
4902 void BackEdgeTable::PatchAt(Code* unoptimized_code,
4903 Address pc_after,
4904 Code* replacement_code) {
4905 // Turn the jump into nops.
4906 Address call_target_address = pc_after - kIntSize;
4907 *(call_target_address - 3) = kNopByteOne;
4908 *(call_target_address - 2) = kNopByteTwo;
4909 // Replace the call address.
4910 Assembler::set_target_address_at(call_target_address,
4911 replacement_code->entry());
4912
4913 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
4914 unoptimized_code, call_target_address, replacement_code);
4915 }
4916
4917
4918 void BackEdgeTable::RevertAt(Code* unoptimized_code,
4919 Address pc_after,
4920 Code* interrupt_code) {
4921 // Restore the original jump.
4922 Address call_target_address = pc_after - kIntSize;
4923 *(call_target_address - 3) = kJnsInstruction;
4924 *(call_target_address - 2) = kJnsOffset;
4925 // Restore the original call address.
4926 Assembler::set_target_address_at(call_target_address,
4927 interrupt_code->entry());
4928
4929 interrupt_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
4930 unoptimized_code, call_target_address, interrupt_code);
4931 }
4932
4933
4934 #ifdef DEBUG
4935 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState(
4936 Isolate* isolate,
4937 Code* unoptimized_code,
4938 Address pc_after) {
4939 Address call_target_address = pc_after - kIntSize;
4940 ASSERT_EQ(kCallInstruction, *(call_target_address - 1));
4941 if (*(call_target_address - 3) == kNopByteOne) {
4942 ASSERT_EQ(kNopByteTwo, *(call_target_address - 2));
4943 Code* osr_builtin =
4944 isolate->builtins()->builtin(Builtins::kOnStackReplacement);
4945 ASSERT_EQ(osr_builtin->entry(),
4946 Assembler::target_address_at(call_target_address));
4947 return ON_STACK_REPLACEMENT;
4948 } else {
4949 // Get the interrupt stub code object to match against from cache.
4950 Code* interrupt_builtin =
4951 isolate->builtins()->builtin(Builtins::kInterruptCheck);
4952 ASSERT_EQ(interrupt_builtin->entry(),
4953 Assembler::target_address_at(call_target_address));
4954 ASSERT_EQ(kJnsInstruction, *(call_target_address - 3));
4955 ASSERT_EQ(kJnsOffset, *(call_target_address - 2));
4956 return INTERRUPT;
4957 }
4958 }
4959 #endif // DEBUG
4960
4961
4886 } } // namespace v8::internal 4962 } } // namespace v8::internal
4887 4963
4888 #endif // V8_TARGET_ARCH_X64 4964 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/deoptimizer-x64.cc ('k') | src/x64/lithium-codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698