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