| OLD | NEW | 
|     1 // Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file |     1 // Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file | 
|     2 // for details. All rights reserved. Use of this source code is governed by a |     2 // for details. All rights reserved. Use of this source code is governed by a | 
|     3 // BSD-style license that can be found in the LICENSE file. |     3 // BSD-style license that can be found in the LICENSE file. | 
|     4  |     4  | 
|     5 #include "vm/intermediate_language.h" |     5 #include "vm/intermediate_language.h" | 
|     6  |     6  | 
|     7 #include "vm/bit_vector.h" |     7 #include "vm/bit_vector.h" | 
|     8 #include "vm/bootstrap.h" |     8 #include "vm/bootstrap.h" | 
|     9 #include "vm/compiler.h" |     9 #include "vm/compiler.h" | 
|    10 #include "vm/constant_propagator.h" |    10 #include "vm/constant_propagator.h" | 
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   120  |   120  | 
|   121  |   121  | 
|   122 static int LowestFirst(const intptr_t* a, const intptr_t* b) { |   122 static int LowestFirst(const intptr_t* a, const intptr_t* b) { | 
|   123   return *a - *b; |   123   return *a - *b; | 
|   124 } |   124 } | 
|   125  |   125  | 
|   126  |   126  | 
|   127 CheckClassInstr::CheckClassInstr(Value* value, |   127 CheckClassInstr::CheckClassInstr(Value* value, | 
|   128                                  intptr_t deopt_id, |   128                                  intptr_t deopt_id, | 
|   129                                  const ICData& unary_checks, |   129                                  const ICData& unary_checks, | 
|   130                                  intptr_t token_pos) |   130                                  TokenPosition token_pos) | 
|   131     : TemplateInstruction(deopt_id), |   131     : TemplateInstruction(deopt_id), | 
|   132       unary_checks_(unary_checks), |   132       unary_checks_(unary_checks), | 
|   133       cids_(unary_checks.NumberOfChecks()), |   133       cids_(unary_checks.NumberOfChecks()), | 
|   134       licm_hoisted_(false), |   134       licm_hoisted_(false), | 
|   135       token_pos_(token_pos) { |   135       token_pos_(token_pos) { | 
|   136   ASSERT(unary_checks.IsZoneHandle()); |   136   ASSERT(unary_checks.IsZoneHandle()); | 
|   137   // Expected useful check data. |   137   // Expected useful check data. | 
|   138   ASSERT(!unary_checks_.IsNull()); |   138   ASSERT(!unary_checks_.IsNull()); | 
|   139   ASSERT(unary_checks_.NumberOfChecks() > 0); |   139   ASSERT(unary_checks_.NumberOfChecks() > 0); | 
|   140   ASSERT(unary_checks_.NumArgsTested() == 1); |   140   ASSERT(unary_checks_.NumArgsTested() == 1); | 
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   413 } |   413 } | 
|   414  |   414  | 
|   415  |   415  | 
|   416 const Field& LoadStaticFieldInstr::StaticField() const { |   416 const Field& LoadStaticFieldInstr::StaticField() const { | 
|   417   Field& field = Field::Handle(); |   417   Field& field = Field::Handle(); | 
|   418   field ^= field_value()->BoundConstant().raw(); |   418   field ^= field_value()->BoundConstant().raw(); | 
|   419   return field; |   419   return field; | 
|   420 } |   420 } | 
|   421  |   421  | 
|   422  |   422  | 
|   423 ConstantInstr::ConstantInstr(const Object& value, intptr_t token_pos) |   423 ConstantInstr::ConstantInstr(const Object& value, TokenPosition token_pos) | 
|   424     : value_(value), |   424     : value_(value), | 
|   425       token_pos_(token_pos) { |   425       token_pos_(token_pos) { | 
|   426   // Check that the value is not an incorrect Integer representation. |   426   // Check that the value is not an incorrect Integer representation. | 
|   427   ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoSmi()); |   427   ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoSmi()); | 
|   428   ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoInt64()); |   428   ASSERT(!value.IsBigint() || !Bigint::Cast(value).FitsIntoInt64()); | 
|   429   ASSERT(!value.IsMint() || !Smi::IsValid(Mint::Cast(value).AsInt64Value())); |   429   ASSERT(!value.IsMint() || !Smi::IsValid(Mint::Cast(value).AsInt64Value())); | 
|   430 } |   430 } | 
|   431  |   431  | 
|   432  |   432  | 
|   433 bool ConstantInstr::AttributesEqual(Instruction* other) const { |   433 bool ConstantInstr::AttributesEqual(Instruction* other) const { | 
| (...skipping 2293 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2727   UNREACHABLE(); |  2727   UNREACHABLE(); | 
|  2728   return NULL; |  2728   return NULL; | 
|  2729 } |  2729 } | 
|  2730  |  2730  | 
|  2731  |  2731  | 
|  2732 void JoinEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |  2732 void JoinEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 
|  2733   __ Bind(compiler->GetJumpLabel(this)); |  2733   __ Bind(compiler->GetJumpLabel(this)); | 
|  2734   if (!compiler->is_optimizing()) { |  2734   if (!compiler->is_optimizing()) { | 
|  2735     compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |  2735     compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 
|  2736                                    GetDeoptId(), |  2736                                    GetDeoptId(), | 
|  2737                                    Token::kNoSourcePos); |  2737                                    TokenPosition::kNoSource); | 
|  2738   } |  2738   } | 
|  2739   if (HasParallelMove()) { |  2739   if (HasParallelMove()) { | 
|  2740     compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |  2740     compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 
|  2741   } |  2741   } | 
|  2742 } |  2742 } | 
|  2743  |  2743  | 
|  2744  |  2744  | 
|  2745 LocationSummary* TargetEntryInstr::MakeLocationSummary(Zone* zone, |  2745 LocationSummary* TargetEntryInstr::MakeLocationSummary(Zone* zone, | 
|  2746                                                        bool optimizing) const { |  2746                                                        bool optimizing) const { | 
|  2747   UNREACHABLE(); |  2747   UNREACHABLE(); | 
|  2748   return NULL; |  2748   return NULL; | 
|  2749 } |  2749 } | 
|  2750  |  2750  | 
|  2751  |  2751  | 
|  2752 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |  2752 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 
|  2753   __ Bind(compiler->GetJumpLabel(this)); |  2753   __ Bind(compiler->GetJumpLabel(this)); | 
|  2754   if (!compiler->is_optimizing()) { |  2754   if (!compiler->is_optimizing()) { | 
|  2755     if (compiler->NeedsEdgeCounter(this)) { |  2755     if (compiler->NeedsEdgeCounter(this)) { | 
|  2756       compiler->EmitEdgeCounter(preorder_number()); |  2756       compiler->EmitEdgeCounter(preorder_number()); | 
|  2757     } |  2757     } | 
|  2758     // The deoptimization descriptor points after the edge counter code for |  2758     // The deoptimization descriptor points after the edge counter code for | 
|  2759     // uniformity with ARM and MIPS, where we can reuse pattern matching |  2759     // uniformity with ARM and MIPS, where we can reuse pattern matching | 
|  2760     // code that matches backwards from the end of the pattern. |  2760     // code that matches backwards from the end of the pattern. | 
|  2761     compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |  2761     compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | 
|  2762                                    GetDeoptId(), |  2762                                    GetDeoptId(), | 
|  2763                                    Token::kNoSourcePos); |  2763                                    TokenPosition::kNoSource); | 
|  2764   } |  2764   } | 
|  2765   if (HasParallelMove()) { |  2765   if (HasParallelMove()) { | 
|  2766     compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |  2766     compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 
|  2767   } |  2767   } | 
|  2768 } |  2768 } | 
|  2769  |  2769  | 
|  2770  |  2770  | 
|  2771 void IndirectGotoInstr::ComputeOffsetTable() { |  2771 void IndirectGotoInstr::ComputeOffsetTable() { | 
|  2772   if (GetBlock()->offset() < 0) { |  2772   if (GetBlock()->offset() < 0) { | 
|  2773     // Don't generate a table when contained in an unreachable block. |  2773     // Don't generate a table when contained in an unreachable block. | 
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2954  |  2954  | 
|  2955  |  2955  | 
|  2956 void DropTempsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |  2956 void DropTempsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 
|  2957   ASSERT(!compiler->is_optimizing()); |  2957   ASSERT(!compiler->is_optimizing()); | 
|  2958   // Assert that register assignment is correct. |  2958   // Assert that register assignment is correct. | 
|  2959   ASSERT((InputCount() == 0) || (locs()->out(0).reg() == locs()->in(0).reg())); |  2959   ASSERT((InputCount() == 0) || (locs()->out(0).reg() == locs()->in(0).reg())); | 
|  2960   __ Drop(num_temps()); |  2960   __ Drop(num_temps()); | 
|  2961 } |  2961 } | 
|  2962  |  2962  | 
|  2963  |  2963  | 
|  2964 StrictCompareInstr::StrictCompareInstr(intptr_t token_pos, |  2964 StrictCompareInstr::StrictCompareInstr(TokenPosition token_pos, | 
|  2965                                        Token::Kind kind, |  2965                                        Token::Kind kind, | 
|  2966                                        Value* left, |  2966                                        Value* left, | 
|  2967                                        Value* right, |  2967                                        Value* right, | 
|  2968                                        bool needs_number_check) |  2968                                        bool needs_number_check) | 
|  2969     : ComparisonInstr(token_pos, |  2969     : ComparisonInstr(token_pos, | 
|  2970                       kind, |  2970                       kind, | 
|  2971                       left, |  2971                       left, | 
|  2972                       right, |  2972                       right, | 
|  2973                       Thread::Current()->GetNextDeoptId()), |  2973                       Thread::Current()->GetNextDeoptId()), | 
|  2974       needs_number_check_(needs_number_check) { |  2974       needs_number_check_(needs_number_check) { | 
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3512   const String& concatenated = String::ZoneHandle(zone, |  3512   const String& concatenated = String::ZoneHandle(zone, | 
|  3513       Symbols::FromConcatAll(pieces)); |  3513       Symbols::FromConcatAll(pieces)); | 
|  3514   return flow_graph->GetConstant(concatenated); |  3514   return flow_graph->GetConstant(concatenated); | 
|  3515 } |  3515 } | 
|  3516  |  3516  | 
|  3517  |  3517  | 
|  3518 InvokeMathCFunctionInstr::InvokeMathCFunctionInstr( |  3518 InvokeMathCFunctionInstr::InvokeMathCFunctionInstr( | 
|  3519     ZoneGrowableArray<Value*>* inputs, |  3519     ZoneGrowableArray<Value*>* inputs, | 
|  3520     intptr_t deopt_id, |  3520     intptr_t deopt_id, | 
|  3521     MethodRecognizer::Kind recognized_kind, |  3521     MethodRecognizer::Kind recognized_kind, | 
|  3522     intptr_t token_pos) |  3522     TokenPosition token_pos) | 
|  3523     : PureDefinition(deopt_id), |  3523     : PureDefinition(deopt_id), | 
|  3524       inputs_(inputs), |  3524       inputs_(inputs), | 
|  3525       recognized_kind_(recognized_kind), |  3525       recognized_kind_(recognized_kind), | 
|  3526       token_pos_(token_pos) { |  3526       token_pos_(token_pos) { | 
|  3527   ASSERT(inputs_->length() == ArgumentCountFor(recognized_kind_)); |  3527   ASSERT(inputs_->length() == ArgumentCountFor(recognized_kind_)); | 
|  3528   for (intptr_t i = 0; i < inputs_->length(); ++i) { |  3528   for (intptr_t i = 0; i < inputs_->length(); ++i) { | 
|  3529     ASSERT((*inputs)[i] != NULL); |  3529     ASSERT((*inputs)[i] != NULL); | 
|  3530     (*inputs)[i]->set_instruction(this); |  3530     (*inputs)[i]->set_instruction(this); | 
|  3531     (*inputs)[i]->set_use_index(i); |  3531     (*inputs)[i]->set_use_index(i); | 
|  3532   } |  3532   } | 
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3697   set_native_c_function(native_function); |  3697   set_native_c_function(native_function); | 
|  3698   function().SetIsNativeAutoSetupScope(auto_setup_scope); |  3698   function().SetIsNativeAutoSetupScope(auto_setup_scope); | 
|  3699   Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |  3699   Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 
|  3700   bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |  3700   bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 
|  3701   set_is_bootstrap_native(is_bootstrap_native); |  3701   set_is_bootstrap_native(is_bootstrap_native); | 
|  3702 } |  3702 } | 
|  3703  |  3703  | 
|  3704 #undef __ |  3704 #undef __ | 
|  3705  |  3705  | 
|  3706 }  // namespace dart |  3706 }  // namespace dart | 
| OLD | NEW |