OLD | NEW |
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 | 87 |
88 void EmitJumpIfEitherNotSmi(Register reg1, Register reg2, Label* target) { | 88 void EmitJumpIfEitherNotSmi(Register reg1, Register reg2, Label* target) { |
89 // We need to use ip0, so don't allow access to the MacroAssembler. | 89 // We need to use ip0, so don't allow access to the MacroAssembler. |
90 InstructionAccurateScope scope(masm_); | 90 InstructionAccurateScope scope(masm_); |
91 __ orr(ip0, reg1, reg2); | 91 __ orr(ip0, reg1, reg2); |
92 EmitJumpIfNotSmi(ip0, target); | 92 EmitJumpIfNotSmi(ip0, target); |
93 } | 93 } |
94 | 94 |
95 void EmitPatchInfo() { | 95 void EmitPatchInfo() { |
96 Assembler::BlockConstPoolScope scope(masm_); | 96 Assembler::BlockPoolsScope scope(masm_); |
97 InlineSmiCheckInfo::Emit(masm_, reg_, &patch_site_); | 97 InlineSmiCheckInfo::Emit(masm_, reg_, &patch_site_); |
98 #ifdef DEBUG | 98 #ifdef DEBUG |
99 info_emitted_ = true; | 99 info_emitted_ = true; |
100 #endif | 100 #endif |
101 } | 101 } |
102 | 102 |
103 private: | 103 private: |
104 MacroAssembler* masm_; | 104 MacroAssembler* masm_; |
105 Label patch_site_; | 105 Label patch_site_; |
106 Register reg_; | 106 Register reg_; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 __ Mov(x3, Operand(Smi::FromInt(reset_value))); | 343 __ Mov(x3, Operand(Smi::FromInt(reset_value))); |
344 __ Str(x3, FieldMemOperand(x2, Cell::kValueOffset)); | 344 __ Str(x3, FieldMemOperand(x2, Cell::kValueOffset)); |
345 } | 345 } |
346 | 346 |
347 | 347 |
348 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, | 348 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, |
349 Label* back_edge_target) { | 349 Label* back_edge_target) { |
350 ASSERT(jssp.Is(__ StackPointer())); | 350 ASSERT(jssp.Is(__ StackPointer())); |
351 Comment cmnt(masm_, "[ Back edge bookkeeping"); | 351 Comment cmnt(masm_, "[ Back edge bookkeeping"); |
352 // Block literal pools whilst emitting back edge code. | 352 // Block literal pools whilst emitting back edge code. |
353 Assembler::BlockConstPoolScope block_const_pool(masm_); | 353 Assembler::BlockPoolsScope block_const_pool(masm_); |
354 Label ok; | 354 Label ok; |
355 | 355 |
356 ASSERT(back_edge_target->is_bound()); | 356 ASSERT(back_edge_target->is_bound()); |
357 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); | 357 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); |
358 int weight = Min(kMaxBackEdgeWeight, | 358 int weight = Min(kMaxBackEdgeWeight, |
359 Max(1, distance / kCodeSizeMultiplier)); | 359 Max(1, distance / kCodeSizeMultiplier)); |
360 EmitProfilingCounterDecrement(weight); | 360 EmitProfilingCounterDecrement(weight); |
361 __ B(pl, &ok); | 361 __ B(pl, &ok); |
362 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); | 362 __ Call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); |
363 | 363 |
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2000 __ Pop(left); | 2000 __ Pop(left); |
2001 | 2001 |
2002 // Perform combined smi check on both operands. | 2002 // Perform combined smi check on both operands. |
2003 __ Orr(x10, left, right); | 2003 __ Orr(x10, left, right); |
2004 JumpPatchSite patch_site(masm_); | 2004 JumpPatchSite patch_site(masm_); |
2005 patch_site.EmitJumpIfSmi(x10, &both_smis); | 2005 patch_site.EmitJumpIfSmi(x10, &both_smis); |
2006 | 2006 |
2007 __ Bind(&stub_call); | 2007 __ Bind(&stub_call); |
2008 BinaryOpICStub stub(op, mode); | 2008 BinaryOpICStub stub(op, mode); |
2009 { | 2009 { |
2010 Assembler::BlockConstPoolScope scope(masm_); | 2010 Assembler::BlockPoolsScope scope(masm_); |
2011 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); | 2011 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); |
2012 patch_site.EmitPatchInfo(); | 2012 patch_site.EmitPatchInfo(); |
2013 } | 2013 } |
2014 __ B(&done); | 2014 __ B(&done); |
2015 | 2015 |
2016 __ Bind(&both_smis); | 2016 __ Bind(&both_smis); |
2017 // Smi case. This code works in the same way as the smi-smi case in the type | 2017 // Smi case. This code works in the same way as the smi-smi case in the type |
2018 // recording binary operation stub, see | 2018 // recording binary operation stub, see |
2019 // BinaryOpStub::GenerateSmiSmiOperation for comments. | 2019 // BinaryOpStub::GenerateSmiSmiOperation for comments. |
2020 // TODO(all): That doesn't exist any more. Where are the comments? | 2020 // TODO(all): That doesn't exist any more. Where are the comments? |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 } | 2086 } |
2087 | 2087 |
2088 | 2088 |
2089 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 2089 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
2090 Token::Value op, | 2090 Token::Value op, |
2091 OverwriteMode mode) { | 2091 OverwriteMode mode) { |
2092 __ Pop(x1); | 2092 __ Pop(x1); |
2093 BinaryOpICStub stub(op, mode); | 2093 BinaryOpICStub stub(op, mode); |
2094 JumpPatchSite patch_site(masm_); // Unbound, signals no inlined smi code. | 2094 JumpPatchSite patch_site(masm_); // Unbound, signals no inlined smi code. |
2095 { | 2095 { |
2096 Assembler::BlockConstPoolScope scope(masm_); | 2096 Assembler::BlockPoolsScope scope(masm_); |
2097 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); | 2097 CallIC(stub.GetCode(isolate()), expr->BinaryOperationFeedbackId()); |
2098 patch_site.EmitPatchInfo(); | 2098 patch_site.EmitPatchInfo(); |
2099 } | 2099 } |
2100 context()->Plug(x0); | 2100 context()->Plug(x0); |
2101 } | 2101 } |
2102 | 2102 |
2103 | 2103 |
2104 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2104 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
2105 // Invalid left-hand sides are rewritten to have a 'throw | 2105 // Invalid left-hand sides are rewritten to have a 'throw |
2106 // ReferenceError' on the left-hand side. | 2106 // ReferenceError' on the left-hand side. |
(...skipping 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4110 } | 4110 } |
4111 | 4111 |
4112 __ Bind(&stub_call); | 4112 __ Bind(&stub_call); |
4113 __ Mov(x1, x0); | 4113 __ Mov(x1, x0); |
4114 __ Mov(x0, Operand(Smi::FromInt(count_value))); | 4114 __ Mov(x0, Operand(Smi::FromInt(count_value))); |
4115 | 4115 |
4116 // Record position before stub call. | 4116 // Record position before stub call. |
4117 SetSourcePosition(expr->position()); | 4117 SetSourcePosition(expr->position()); |
4118 | 4118 |
4119 { | 4119 { |
4120 Assembler::BlockConstPoolScope scope(masm_); | 4120 Assembler::BlockPoolsScope scope(masm_); |
4121 BinaryOpICStub stub(Token::ADD, NO_OVERWRITE); | 4121 BinaryOpICStub stub(Token::ADD, NO_OVERWRITE); |
4122 CallIC(stub.GetCode(isolate()), expr->CountBinOpFeedbackId()); | 4122 CallIC(stub.GetCode(isolate()), expr->CountBinOpFeedbackId()); |
4123 patch_site.EmitPatchInfo(); | 4123 patch_site.EmitPatchInfo(); |
4124 } | 4124 } |
4125 __ Bind(&done); | 4125 __ Bind(&done); |
4126 | 4126 |
4127 // Store the value returned in x0. | 4127 // Store the value returned in x0. |
4128 switch (assign_type) { | 4128 switch (assign_type) { |
4129 case VARIABLE: | 4129 case VARIABLE: |
4130 if (expr->is_postfix()) { | 4130 if (expr->is_postfix()) { |
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4984 return previous_; | 4984 return previous_; |
4985 } | 4985 } |
4986 | 4986 |
4987 | 4987 |
4988 #undef __ | 4988 #undef __ |
4989 | 4989 |
4990 | 4990 |
4991 } } // namespace v8::internal | 4991 } } // namespace v8::internal |
4992 | 4992 |
4993 #endif // V8_TARGET_ARCH_A64 | 4993 #endif // V8_TARGET_ARCH_A64 |
OLD | NEW |