OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } else { | 44 } else { |
45 return Handle<Object>(value, isolate()); | 45 return Handle<Object>(value, isolate()); |
46 } | 46 } |
47 } | 47 } |
48 return Handle<Object>::cast(isolate()->factory()->undefined_value()); | 48 return Handle<Object>::cast(isolate()->factory()->undefined_value()); |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorSlot slot) { | 52 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorSlot slot) { |
53 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length()); | 53 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length()); |
| 54 Handle<Object> undefined = |
| 55 Handle<Object>::cast(isolate()->factory()->undefined_value()); |
54 Object* obj = feedback_vector_->Get(slot); | 56 Object* obj = feedback_vector_->Get(slot); |
| 57 |
| 58 // Slots do not embed direct pointers to functions. Instead a WeakCell is |
| 59 // always used. |
| 60 DCHECK(!obj->IsJSFunction()); |
| 61 if (obj->IsWeakCell()) { |
| 62 WeakCell* cell = WeakCell::cast(obj); |
| 63 if (cell->cleared()) return undefined; |
| 64 obj = cell->value(); |
| 65 } |
| 66 |
55 return Handle<Object>(obj, isolate()); | 67 return Handle<Object>(obj, isolate()); |
56 } | 68 } |
57 | 69 |
58 | 70 |
59 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorICSlot slot) { | 71 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorICSlot slot) { |
60 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length()); | 72 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length()); |
61 Handle<Object> undefined = | 73 Handle<Object> undefined = |
62 Handle<Object>::cast(isolate()->factory()->undefined_value()); | 74 Handle<Object>::cast(isolate()->factory()->undefined_value()); |
63 Object* obj = feedback_vector_->Get(slot); | 75 Object* obj = feedback_vector_->Get(slot); |
64 | 76 |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 UnseededNumberDictionary::kNotFound); | 532 UnseededNumberDictionary::kNotFound); |
521 // Dictionary has been allocated with sufficient size for all elements. | 533 // Dictionary has been allocated with sufficient size for all elements. |
522 DisallowHeapAllocation no_need_to_resize_dictionary; | 534 DisallowHeapAllocation no_need_to_resize_dictionary; |
523 HandleScope scope(isolate()); | 535 HandleScope scope(isolate()); |
524 USE(UnseededNumberDictionary::AtNumberPut( | 536 USE(UnseededNumberDictionary::AtNumberPut( |
525 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 537 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
526 } | 538 } |
527 | 539 |
528 | 540 |
529 } } // namespace v8::internal | 541 } } // namespace v8::internal |
OLD | NEW |