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/globals.h" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 | 1966 |
1967 | 1967 |
1968 // When the parser is building an implicit static getter for optimization, | 1968 // When the parser is building an implicit static getter for optimization, |
1969 // it can generate a function body where deoptimization ids do not line up | 1969 // it can generate a function body where deoptimization ids do not line up |
1970 // with the unoptimized code. | 1970 // with the unoptimized code. |
1971 // | 1971 // |
1972 // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. | 1972 // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. |
1973 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1973 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1974 Register field = locs()->in(0).reg(); | 1974 Register field = locs()->in(0).reg(); |
1975 Register result = locs()->out(0).reg(); | 1975 Register result = locs()->out(0).reg(); |
1976 __ movq(result, FieldAddress(field, Field::value_offset())); | 1976 __ movq(result, FieldAddress(field, Field::static_value_offset())); |
1977 } | 1977 } |
1978 | 1978 |
1979 | 1979 |
1980 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, | 1980 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, |
1981 bool opt) const { | 1981 bool opt) const { |
1982 LocationSummary* locs = new(zone) LocationSummary( | 1982 LocationSummary* locs = new(zone) LocationSummary( |
1983 zone, 1, 1, LocationSummary::kNoCall); | 1983 zone, 1, 1, LocationSummary::kNoCall); |
1984 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() | 1984 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() |
1985 : Location::RequiresRegister()); | 1985 : Location::RequiresRegister()); |
1986 locs->set_temp(0, Location::RequiresRegister()); | 1986 locs->set_temp(0, Location::RequiresRegister()); |
1987 return locs; | 1987 return locs; |
1988 } | 1988 } |
1989 | 1989 |
1990 | 1990 |
1991 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1991 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1992 Register value = locs()->in(0).reg(); | 1992 Register value = locs()->in(0).reg(); |
1993 Register temp = locs()->temp(0).reg(); | 1993 Register temp = locs()->temp(0).reg(); |
1994 | 1994 |
1995 __ LoadObject(temp, field()); | 1995 __ LoadObject(temp, field()); |
1996 if (this->value()->NeedsStoreBuffer()) { | 1996 if (this->value()->NeedsStoreBuffer()) { |
1997 __ StoreIntoObject(temp, | 1997 __ StoreIntoObject(temp, |
1998 FieldAddress(temp, Field::value_offset()), value, CanValueBeSmi()); | 1998 FieldAddress(temp, Field::static_value_offset()), |
| 1999 value, |
| 2000 CanValueBeSmi()); |
1999 } else { | 2001 } else { |
2000 __ StoreIntoObjectNoBarrier( | 2002 __ StoreIntoObjectNoBarrier( |
2001 temp, FieldAddress(temp, Field::value_offset()), value); | 2003 temp, FieldAddress(temp, Field::static_value_offset()), value); |
2002 } | 2004 } |
2003 } | 2005 } |
2004 | 2006 |
2005 | 2007 |
2006 LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, | 2008 LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, |
2007 bool opt) const { | 2009 bool opt) const { |
2008 const intptr_t kNumInputs = 3; | 2010 const intptr_t kNumInputs = 3; |
2009 const intptr_t kNumTemps = 0; | 2011 const intptr_t kNumTemps = 0; |
2010 LocationSummary* summary = new(zone) LocationSummary( | 2012 LocationSummary* summary = new(zone) LocationSummary( |
2011 zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2013 zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2482 return locs; | 2484 return locs; |
2483 } | 2485 } |
2484 | 2486 |
2485 | 2487 |
2486 void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2488 void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2487 Register field = locs()->in(0).reg(); | 2489 Register field = locs()->in(0).reg(); |
2488 Register temp = locs()->temp(0).reg(); | 2490 Register temp = locs()->temp(0).reg(); |
2489 | 2491 |
2490 Label call_runtime, no_call; | 2492 Label call_runtime, no_call; |
2491 | 2493 |
2492 __ movq(temp, FieldAddress(field, Field::value_offset())); | 2494 __ movq(temp, FieldAddress(field, Field::static_value_offset())); |
2493 __ CompareObject(temp, Object::sentinel()); | 2495 __ CompareObject(temp, Object::sentinel()); |
2494 __ j(EQUAL, &call_runtime); | 2496 __ j(EQUAL, &call_runtime); |
2495 | 2497 |
2496 __ CompareObject(temp, Object::transition_sentinel()); | 2498 __ CompareObject(temp, Object::transition_sentinel()); |
2497 __ j(NOT_EQUAL, &no_call); | 2499 __ j(NOT_EQUAL, &no_call); |
2498 | 2500 |
2499 __ Bind(&call_runtime); | 2501 __ Bind(&call_runtime); |
2500 __ PushObject(Object::null_object()); // Make room for (unused) result. | 2502 __ PushObject(Object::null_object()); // Make room for (unused) result. |
2501 __ pushq(field); | 2503 __ pushq(field); |
2502 compiler->GenerateRuntimeCall(token_pos(), | 2504 compiler->GenerateRuntimeCall(token_pos(), |
(...skipping 3937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6440 __ Drop(1); | 6442 __ Drop(1); |
6441 __ popq(result); | 6443 __ popq(result); |
6442 } | 6444 } |
6443 | 6445 |
6444 | 6446 |
6445 } // namespace dart | 6447 } // namespace dart |
6446 | 6448 |
6447 #undef __ | 6449 #undef __ |
6448 | 6450 |
6449 #endif // defined TARGET_ARCH_X64 | 6451 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |