| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 3306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3317 LoadFieldInstr* load = new(Z) LoadFieldInstr(receiver, | 3317 LoadFieldInstr* load = new(Z) LoadFieldInstr(receiver, |
| 3318 offset, | 3318 offset, |
| 3319 type, | 3319 type, |
| 3320 node->token_pos()); | 3320 node->token_pos()); |
| 3321 load->set_result_cid(class_id); | 3321 load->set_result_cid(class_id); |
| 3322 load->set_recognized_kind(kind); | 3322 load->set_recognized_kind(kind); |
| 3323 return load; | 3323 return load; |
| 3324 } | 3324 } |
| 3325 | 3325 |
| 3326 | 3326 |
| 3327 ConstantInstr* EffectGraphVisitor::DoNativeSetterStoreValue( |
| 3328 NativeBodyNode* node, |
| 3329 intptr_t offset, |
| 3330 StoreBarrierType emit_store_barrier) { |
| 3331 Value* receiver = Bind(BuildLoadThisVar(node->scope())); |
| 3332 LocalVariable* value_var = |
| 3333 node->scope()->LookupVariable(Symbols::Value(), true); |
| 3334 Value* value = Bind(new(Z) LoadLocalInstr(*value_var)); |
| 3335 StoreInstanceFieldInstr* store = new(Z) StoreInstanceFieldInstr( |
| 3336 offset, |
| 3337 receiver, |
| 3338 value, |
| 3339 emit_store_barrier, |
| 3340 node->token_pos()); |
| 3341 Do(store); |
| 3342 return new(Z) ConstantInstr(Object::ZoneHandle(Z, Object::null())); |
| 3343 } |
| 3344 |
| 3345 |
| 3327 void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) { | 3346 void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) { |
| 3328 const Function& function = owner()->function(); | 3347 const Function& function = owner()->function(); |
| 3329 if (!function.IsClosureFunction()) { | 3348 if (!function.IsClosureFunction()) { |
| 3330 MethodRecognizer::Kind kind = MethodRecognizer::RecognizeKind(function); | 3349 MethodRecognizer::Kind kind = MethodRecognizer::RecognizeKind(function); |
| 3331 switch (kind) { | 3350 switch (kind) { |
| 3332 case MethodRecognizer::kObjectEquals: { | 3351 case MethodRecognizer::kObjectEquals: { |
| 3333 Value* receiver = Bind(BuildLoadThisVar(node->scope())); | 3352 Value* receiver = Bind(BuildLoadThisVar(node->scope())); |
| 3334 LocalVariable* other_var = | 3353 LocalVariable* other_var = |
| 3335 node->scope()->LookupVariable(Symbols::Other(), | 3354 node->scope()->LookupVariable(Symbols::Other(), |
| 3336 true); // Test only. | 3355 true); // Test only. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3420 return ReturnDefinition(BuildNativeGetter( | 3439 return ReturnDefinition(BuildNativeGetter( |
| 3421 node, kind, Bigint::digits_offset(), | 3440 node, kind, Bigint::digits_offset(), |
| 3422 Type::ZoneHandle(Z, Type::DynamicType()), | 3441 Type::ZoneHandle(Z, Type::DynamicType()), |
| 3423 kTypedDataUint32ArrayCid)); | 3442 kTypedDataUint32ArrayCid)); |
| 3424 } | 3443 } |
| 3425 case MethodRecognizer::kBigint_getUsed: { | 3444 case MethodRecognizer::kBigint_getUsed: { |
| 3426 return ReturnDefinition(BuildNativeGetter( | 3445 return ReturnDefinition(BuildNativeGetter( |
| 3427 node, kind, Bigint::used_offset(), | 3446 node, kind, Bigint::used_offset(), |
| 3428 Type::ZoneHandle(Z, Type::SmiType()), kSmiCid)); | 3447 Type::ZoneHandle(Z, Type::SmiType()), kSmiCid)); |
| 3429 } | 3448 } |
| 3449 case MethodRecognizer::kLinkedHashMap_getIndex: { |
| 3450 return ReturnDefinition(BuildNativeGetter( |
| 3451 node, kind, LinkedHashMap::index_offset(), |
| 3452 Type::ZoneHandle(Z, Type::DynamicType()), |
| 3453 kTypedDataUint32ArrayCid)); |
| 3454 } |
| 3455 case MethodRecognizer::kLinkedHashMap_setIndex: { |
| 3456 return ReturnDefinition(DoNativeSetterStoreValue( |
| 3457 node, LinkedHashMap::index_offset(), kEmitStoreBarrier)); |
| 3458 } |
| 3459 case MethodRecognizer::kLinkedHashMap_getData: { |
| 3460 return ReturnDefinition(BuildNativeGetter( |
| 3461 node, kind, LinkedHashMap::data_offset(), |
| 3462 Type::ZoneHandle(Z, Type::DynamicType()), |
| 3463 kArrayCid)); |
| 3464 } |
| 3465 case MethodRecognizer::kLinkedHashMap_setData: { |
| 3466 return ReturnDefinition(DoNativeSetterStoreValue( |
| 3467 node, LinkedHashMap::data_offset(), kEmitStoreBarrier)); |
| 3468 } |
| 3469 case MethodRecognizer::kLinkedHashMap_getHashMask: { |
| 3470 return ReturnDefinition(BuildNativeGetter( |
| 3471 node, kind, LinkedHashMap::hash_mask_offset(), |
| 3472 Type::ZoneHandle(Z, Type::SmiType()), |
| 3473 kSmiCid)); |
| 3474 } |
| 3475 case MethodRecognizer::kLinkedHashMap_setHashMask: { |
| 3476 // Smi field; no barrier needed. |
| 3477 return ReturnDefinition(DoNativeSetterStoreValue( |
| 3478 node, LinkedHashMap::hash_mask_offset(), kNoStoreBarrier)); |
| 3479 } |
| 3480 case MethodRecognizer::kLinkedHashMap_getUsedData: { |
| 3481 return ReturnDefinition(BuildNativeGetter( |
| 3482 node, kind, LinkedHashMap::used_data_offset(), |
| 3483 Type::ZoneHandle(Z, Type::SmiType()), |
| 3484 kSmiCid)); |
| 3485 } |
| 3486 case MethodRecognizer::kLinkedHashMap_setUsedData: { |
| 3487 // Smi field; no barrier needed. |
| 3488 return ReturnDefinition(DoNativeSetterStoreValue( |
| 3489 node, LinkedHashMap::used_data_offset(), kNoStoreBarrier)); |
| 3490 } |
| 3491 case MethodRecognizer::kLinkedHashMap_getDeletedKeys: { |
| 3492 return ReturnDefinition(BuildNativeGetter( |
| 3493 node, kind, LinkedHashMap::deleted_keys_offset(), |
| 3494 Type::ZoneHandle(Z, Type::SmiType()), |
| 3495 kSmiCid)); |
| 3496 } |
| 3497 case MethodRecognizer::kLinkedHashMap_setDeletedKeys: { |
| 3498 // Smi field; no barrier needed. |
| 3499 return ReturnDefinition(DoNativeSetterStoreValue( |
| 3500 node, LinkedHashMap::deleted_keys_offset(), kNoStoreBarrier)); |
| 3501 } |
| 3430 case MethodRecognizer::kBigint_getNeg: { | 3502 case MethodRecognizer::kBigint_getNeg: { |
| 3431 return ReturnDefinition(BuildNativeGetter( | 3503 return ReturnDefinition(BuildNativeGetter( |
| 3432 node, kind, Bigint::neg_offset(), | 3504 node, kind, Bigint::neg_offset(), |
| 3433 Type::ZoneHandle(Z, Type::BoolType()), kBoolCid)); | 3505 Type::ZoneHandle(Z, Type::BoolType()), kBoolCid)); |
| 3434 } | 3506 } |
| 3435 default: | 3507 default: |
| 3436 break; | 3508 break; |
| 3437 } | 3509 } |
| 3438 } | 3510 } |
| 3439 InlineBailout("EffectGraphVisitor::VisitNativeBodyNode"); | 3511 InlineBailout("EffectGraphVisitor::VisitNativeBodyNode"); |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4410 Report::MessageF(Report::kBailout, | 4482 Report::MessageF(Report::kBailout, |
| 4411 Script::Handle(function.script()), | 4483 Script::Handle(function.script()), |
| 4412 function.token_pos(), | 4484 function.token_pos(), |
| 4413 "FlowGraphBuilder Bailout: %s %s", | 4485 "FlowGraphBuilder Bailout: %s %s", |
| 4414 String::Handle(function.name()).ToCString(), | 4486 String::Handle(function.name()).ToCString(), |
| 4415 reason); | 4487 reason); |
| 4416 UNREACHABLE(); | 4488 UNREACHABLE(); |
| 4417 } | 4489 } |
| 4418 | 4490 |
| 4419 } // namespace dart | 4491 } // namespace dart |
| OLD | NEW |