| 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" |
| 11 #include "src/ic/stub-cache.h" | 11 #include "src/ic/stub-cache.h" |
| 12 #include "src/macro-assembler.h" | 12 #include "src/macro-assembler.h" |
| 13 #include "src/type-info.h" | 13 #include "src/type-info.h" |
| 14 | 14 |
| 15 #include "src/objects-inl.h" | 15 #include "src/objects-inl.h" |
| 16 | 16 |
| 17 namespace v8 { | 17 namespace v8 { |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| 20 | 20 |
| 21 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, | 21 TypeFeedbackOracle::TypeFeedbackOracle( |
| 22 Handle<FixedArray> feedback_vector, | 22 Handle<Code> code, Handle<TypeFeedbackVector> feedback_vector, |
| 23 Handle<Context> native_context, | 23 Handle<Context> native_context, Zone* zone) |
| 24 Zone* zone) | 24 : native_context_(native_context), zone_(zone) { |
| 25 : native_context_(native_context), | |
| 26 zone_(zone) { | |
| 27 BuildDictionary(code); | 25 BuildDictionary(code); |
| 28 DCHECK(dictionary_->IsDictionary()); | 26 DCHECK(dictionary_->IsDictionary()); |
| 29 // We make a copy of the feedback vector because a GC could clear | 27 // We make a copy of the feedback vector because a GC could clear |
| 30 // the type feedback info contained therein. | 28 // the type feedback info contained therein. |
| 31 // TODO(mvstanton): revisit the decision to copy when we weakly | 29 // TODO(mvstanton): revisit the decision to copy when we weakly |
| 32 // traverse the feedback vector at GC time. | 30 // traverse the feedback vector at GC time. |
| 33 feedback_vector_ = isolate()->factory()->CopyFixedArray(feedback_vector); | 31 feedback_vector_ = TypeFeedbackVector::Copy(isolate(), feedback_vector); |
| 34 } | 32 } |
| 35 | 33 |
| 36 | 34 |
| 37 static uint32_t IdToKey(TypeFeedbackId ast_id) { | 35 static uint32_t IdToKey(TypeFeedbackId ast_id) { |
| 38 return static_cast<uint32_t>(ast_id.ToInt()); | 36 return static_cast<uint32_t>(ast_id.ToInt()); |
| 39 } | 37 } |
| 40 | 38 |
| 41 | 39 |
| 42 Handle<Object> TypeFeedbackOracle::GetInfo(TypeFeedbackId ast_id) { | 40 Handle<Object> TypeFeedbackOracle::GetInfo(TypeFeedbackId ast_id) { |
| 43 int entry = dictionary_->FindEntry(IdToKey(ast_id)); | 41 int entry = dictionary_->FindEntry(IdToKey(ast_id)); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 UnseededNumberDictionary::kNotFound); | 460 UnseededNumberDictionary::kNotFound); |
| 463 // Dictionary has been allocated with sufficient size for all elements. | 461 // Dictionary has been allocated with sufficient size for all elements. |
| 464 DisallowHeapAllocation no_need_to_resize_dictionary; | 462 DisallowHeapAllocation no_need_to_resize_dictionary; |
| 465 HandleScope scope(isolate()); | 463 HandleScope scope(isolate()); |
| 466 USE(UnseededNumberDictionary::AtNumberPut( | 464 USE(UnseededNumberDictionary::AtNumberPut( |
| 467 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 465 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
| 468 } | 466 } |
| 469 | 467 |
| 470 | 468 |
| 471 } } // namespace v8::internal | 469 } } // namespace v8::internal |
| OLD | NEW |