OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 13639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13650 shared_info->set_language_mode(lit->language_mode()); | 13650 shared_info->set_language_mode(lit->language_mode()); |
13651 shared_info->set_uses_arguments(lit->scope()->arguments() != NULL); | 13651 shared_info->set_uses_arguments(lit->scope()->arguments() != NULL); |
13652 shared_info->set_kind(lit->kind()); | 13652 shared_info->set_kind(lit->kind()); |
13653 if (!IsConstructable(lit->kind())) { | 13653 if (!IsConstructable(lit->kind())) { |
13654 shared_info->SetConstructStub( | 13654 shared_info->SetConstructStub( |
13655 *shared_info->GetIsolate()->builtins()->ConstructedNonConstructable()); | 13655 *shared_info->GetIsolate()->builtins()->ConstructedNonConstructable()); |
13656 } | 13656 } |
13657 shared_info->set_needs_home_object(lit->scope()->NeedsHomeObject()); | 13657 shared_info->set_needs_home_object(lit->scope()->NeedsHomeObject()); |
13658 shared_info->set_asm_function(lit->scope()->asm_function()); | 13658 shared_info->set_asm_function(lit->scope()->asm_function()); |
13659 shared_info->set_function_literal_id(lit->function_literal_id()); | 13659 shared_info->set_function_literal_id(lit->function_literal_id()); |
| 13660 shared_info->set_coverage_info(Smi::kZero); // Set later on bytecode-gen. |
13660 | 13661 |
13661 // For lazy parsed functions, the following flags will be inaccurate since we | 13662 // For lazy parsed functions, the following flags will be inaccurate since we |
13662 // don't have the information yet. They're set later in | 13663 // don't have the information yet. They're set later in |
13663 // SetSharedFunctionFlagsFromLiteral (compiler.cc), when the function is | 13664 // SetSharedFunctionFlagsFromLiteral (compiler.cc), when the function is |
13664 // really parsed and compiled. | 13665 // really parsed and compiled. |
13665 if (lit->body() != nullptr) { | 13666 if (lit->body() != nullptr) { |
13666 shared_info->set_length(lit->function_length()); | 13667 shared_info->set_length(lit->function_length()); |
13667 shared_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); | 13668 shared_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); |
13668 shared_info->SetExpectedNofPropertiesFromEstimate(lit); | 13669 shared_info->SetExpectedNofPropertiesFromEstimate(lit); |
13669 } else { | 13670 } else { |
(...skipping 5607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19277 // Get the number of break points. | 19278 // Get the number of break points. |
19278 int BreakPointInfo::GetBreakPointCount() { | 19279 int BreakPointInfo::GetBreakPointCount() { |
19279 // No break point. | 19280 // No break point. |
19280 if (break_point_objects()->IsUndefined(GetIsolate())) return 0; | 19281 if (break_point_objects()->IsUndefined(GetIsolate())) return 0; |
19281 // Single break point. | 19282 // Single break point. |
19282 if (!break_point_objects()->IsFixedArray()) return 1; | 19283 if (!break_point_objects()->IsFixedArray()) return 1; |
19283 // Multiple break points. | 19284 // Multiple break points. |
19284 return FixedArray::cast(break_point_objects())->length(); | 19285 return FixedArray::cast(break_point_objects())->length(); |
19285 } | 19286 } |
19286 | 19287 |
| 19288 int CoverageInfo::SlotCount() const { |
| 19289 DCHECK_EQ(kFirstSlotIndex, length() % kSlotIndexCount); |
| 19290 return (length() - kFirstSlotIndex) / kSlotIndexCount; |
| 19291 } |
| 19292 |
| 19293 int CoverageInfo::FromSourcePosition(int slot_index) const { |
| 19294 DCHECK_LT(slot_index, SlotCount()); |
| 19295 const int slot_start = CoverageInfo::FirstIndexForSlot(slot_index); |
| 19296 return Smi::ToInt(get(slot_start + kSlotFromSourcePositionIndex)); |
| 19297 } |
| 19298 |
| 19299 int CoverageInfo::ToSourcePosition(int slot_index) const { |
| 19300 DCHECK_LT(slot_index, SlotCount()); |
| 19301 const int slot_start = CoverageInfo::FirstIndexForSlot(slot_index); |
| 19302 return Smi::ToInt(get(slot_start + kSlotToSourcePositionIndex)); |
| 19303 } |
| 19304 |
| 19305 int CoverageInfo::BlockCount(int slot_index) const { |
| 19306 DCHECK_LT(slot_index, SlotCount()); |
| 19307 const int slot_start = CoverageInfo::FirstIndexForSlot(slot_index); |
| 19308 return Smi::ToInt(get(slot_start + kSlotBlockCountIndex)); |
| 19309 } |
| 19310 |
| 19311 void CoverageInfo::InitializeSlot(int slot_index, int from_pos, int to_pos) { |
| 19312 DCHECK_LT(slot_index, SlotCount()); |
| 19313 const int slot_start = CoverageInfo::FirstIndexForSlot(slot_index); |
| 19314 set(slot_start + kSlotFromSourcePositionIndex, Smi::FromInt(from_pos)); |
| 19315 set(slot_start + kSlotToSourcePositionIndex, Smi::FromInt(to_pos)); |
| 19316 set(slot_start + kSlotBlockCountIndex, Smi::kZero); |
| 19317 } |
| 19318 |
| 19319 void CoverageInfo::IncrementBlockCount(int slot_index) { |
| 19320 DCHECK_LT(slot_index, SlotCount()); |
| 19321 const int slot_start = CoverageInfo::FirstIndexForSlot(slot_index); |
| 19322 const int old_count = BlockCount(slot_index); |
| 19323 set(slot_start + kSlotBlockCountIndex, Smi::FromInt(old_count + 1)); |
| 19324 } |
19287 | 19325 |
19288 // static | 19326 // static |
19289 MaybeHandle<JSDate> JSDate::New(Handle<JSFunction> constructor, | 19327 MaybeHandle<JSDate> JSDate::New(Handle<JSFunction> constructor, |
19290 Handle<JSReceiver> new_target, double tv) { | 19328 Handle<JSReceiver> new_target, double tv) { |
19291 Isolate* const isolate = constructor->GetIsolate(); | 19329 Isolate* const isolate = constructor->GetIsolate(); |
19292 Handle<JSObject> result; | 19330 Handle<JSObject> result; |
19293 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, | 19331 ASSIGN_RETURN_ON_EXCEPTION(isolate, result, |
19294 JSObject::New(constructor, new_target), JSDate); | 19332 JSObject::New(constructor, new_target), JSDate); |
19295 if (-DateCache::kMaxTimeInMs <= tv && tv <= DateCache::kMaxTimeInMs) { | 19333 if (-DateCache::kMaxTimeInMs <= tv && tv <= DateCache::kMaxTimeInMs) { |
19296 tv = DoubleToInteger(tv) + 0.0; | 19334 tv = DoubleToInteger(tv) + 0.0; |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20514 // not | 20552 // not |
20515 // depend on this. | 20553 // depend on this. |
20516 return DICTIONARY_ELEMENTS; | 20554 return DICTIONARY_ELEMENTS; |
20517 } | 20555 } |
20518 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20556 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20519 return kind; | 20557 return kind; |
20520 } | 20558 } |
20521 } | 20559 } |
20522 } // namespace internal | 20560 } // namespace internal |
20523 } // namespace v8 | 20561 } // namespace v8 |
OLD | NEW |