OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 2998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3009 // And the result of the length | 3009 // And the result of the length |
3010 HValue* length = AddLoadArrayLength(boilerplate, kind); | 3010 HValue* length = AddLoadArrayLength(boilerplate, kind); |
3011 Add<HStoreNamedField>(result, HObjectAccess::ForArrayLength(kind), length); | 3011 Add<HStoreNamedField>(result, HObjectAccess::ForArrayLength(kind), length); |
3012 | 3012 |
3013 BuildCopyElements(boilerplate_elements, kind, elements, | 3013 BuildCopyElements(boilerplate_elements, kind, elements, |
3014 kind, length, NULL); | 3014 kind, length, NULL); |
3015 return result; | 3015 return result; |
3016 } | 3016 } |
3017 | 3017 |
3018 | 3018 |
3019 void HGraphBuilder::BuildCompareNil( | 3019 void HGraphBuilder::BuildCompareNil(HValue* value, Type* type, |
3020 HValue* value, | 3020 HIfContinuation* continuation, |
3021 Type* type, | 3021 MapEmbedding map_embedding) { |
3022 HIfContinuation* continuation) { | |
3023 IfBuilder if_nil(this); | 3022 IfBuilder if_nil(this); |
3024 bool some_case_handled = false; | 3023 bool some_case_handled = false; |
3025 bool some_case_missing = false; | 3024 bool some_case_missing = false; |
3026 | 3025 |
3027 if (type->Maybe(Type::Null())) { | 3026 if (type->Maybe(Type::Null())) { |
3028 if (some_case_handled) if_nil.Or(); | 3027 if (some_case_handled) if_nil.Or(); |
3029 if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull()); | 3028 if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull()); |
3030 some_case_handled = true; | 3029 some_case_handled = true; |
3031 } else { | 3030 } else { |
3032 some_case_missing = true; | 3031 some_case_missing = true; |
(...skipping 18 matching lines...) Expand all Loading... |
3051 | 3050 |
3052 if (some_case_missing) { | 3051 if (some_case_missing) { |
3053 if_nil.Then(); | 3052 if_nil.Then(); |
3054 if_nil.Else(); | 3053 if_nil.Else(); |
3055 if (type->NumClasses() == 1) { | 3054 if (type->NumClasses() == 1) { |
3056 BuildCheckHeapObject(value); | 3055 BuildCheckHeapObject(value); |
3057 // For ICs, the map checked below is a sentinel map that gets replaced by | 3056 // For ICs, the map checked below is a sentinel map that gets replaced by |
3058 // the monomorphic map when the code is used as a template to generate a | 3057 // the monomorphic map when the code is used as a template to generate a |
3059 // new IC. For optimized functions, there is no sentinel map, the map | 3058 // new IC. For optimized functions, there is no sentinel map, the map |
3060 // emitted below is the actual monomorphic map. | 3059 // emitted below is the actual monomorphic map. |
3061 Add<HCheckMaps>(value, type->Classes().Current()); | 3060 if (map_embedding == kEmbedMapsViaWeakCells) { |
| 3061 HValue* cell = |
| 3062 Add<HConstant>(Map::WeakCellForMap(type->Classes().Current())); |
| 3063 HValue* expected_map = Add<HLoadNamedField>( |
| 3064 cell, nullptr, HObjectAccess::ForWeakCellValue()); |
| 3065 HValue* map = |
| 3066 Add<HLoadNamedField>(value, nullptr, HObjectAccess::ForMap()); |
| 3067 IfBuilder map_check(this); |
| 3068 map_check.IfNot<HCompareObjectEqAndBranch>(expected_map, map); |
| 3069 map_check.ThenDeopt("Unknown map"); |
| 3070 map_check.End(); |
| 3071 } else { |
| 3072 DCHECK(map_embedding == kEmbedMapsDirectly); |
| 3073 Add<HCheckMaps>(value, type->Classes().Current()); |
| 3074 } |
3062 } else { | 3075 } else { |
3063 if_nil.Deopt("Too many undetectable types"); | 3076 if_nil.Deopt("Too many undetectable types"); |
3064 } | 3077 } |
3065 } | 3078 } |
3066 | 3079 |
3067 if_nil.CaptureContinuation(continuation); | 3080 if_nil.CaptureContinuation(continuation); |
3068 } | 3081 } |
3069 | 3082 |
3070 | 3083 |
3071 void HGraphBuilder::BuildCreateAllocationMemento( | 3084 void HGraphBuilder::BuildCreateAllocationMemento( |
(...skipping 10363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13435 if (ShouldProduceTraceOutput()) { | 13448 if (ShouldProduceTraceOutput()) { |
13436 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13449 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13437 } | 13450 } |
13438 | 13451 |
13439 #ifdef DEBUG | 13452 #ifdef DEBUG |
13440 graph_->Verify(false); // No full verify. | 13453 graph_->Verify(false); // No full verify. |
13441 #endif | 13454 #endif |
13442 } | 13455 } |
13443 | 13456 |
13444 } } // namespace v8::internal | 13457 } } // namespace v8::internal |
OLD | NEW |