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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 10668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10679 it.rinfo()->set_target_cell(undefined_cell, SKIP_WRITE_BARRIER); | 10679 it.rinfo()->set_target_cell(undefined_cell, SKIP_WRITE_BARRIER); |
10680 } | 10680 } |
10681 } | 10681 } |
10682 } | 10682 } |
10683 | 10683 |
10684 | 10684 |
10685 void Code::Relocate(intptr_t delta) { | 10685 void Code::Relocate(intptr_t delta) { |
10686 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { | 10686 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { |
10687 it.rinfo()->apply(delta, SKIP_ICACHE_FLUSH); | 10687 it.rinfo()->apply(delta, SKIP_ICACHE_FLUSH); |
10688 } | 10688 } |
10689 CPU::FlushICache(instruction_start(), instruction_size()); | 10689 CpuFeatures::FlushICache(instruction_start(), instruction_size()); |
10690 } | 10690 } |
10691 | 10691 |
10692 | 10692 |
10693 void Code::CopyFrom(const CodeDesc& desc) { | 10693 void Code::CopyFrom(const CodeDesc& desc) { |
10694 ASSERT(Marking::Color(this) == Marking::WHITE_OBJECT); | 10694 ASSERT(Marking::Color(this) == Marking::WHITE_OBJECT); |
10695 | 10695 |
10696 // copy code | 10696 // copy code |
10697 CopyBytes(instruction_start(), desc.buffer, | 10697 CopyBytes(instruction_start(), desc.buffer, |
10698 static_cast<size_t>(desc.instr_size)); | 10698 static_cast<size_t>(desc.instr_size)); |
10699 | 10699 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10733 it.rinfo()->set_target_runtime_entry(p, SKIP_WRITE_BARRIER, | 10733 it.rinfo()->set_target_runtime_entry(p, SKIP_WRITE_BARRIER, |
10734 SKIP_ICACHE_FLUSH); | 10734 SKIP_ICACHE_FLUSH); |
10735 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) { | 10735 } else if (mode == RelocInfo::CODE_AGE_SEQUENCE) { |
10736 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin); | 10736 Handle<Object> p = it.rinfo()->code_age_stub_handle(origin); |
10737 Code* code = Code::cast(*p); | 10737 Code* code = Code::cast(*p); |
10738 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH); | 10738 it.rinfo()->set_code_age_stub(code, SKIP_ICACHE_FLUSH); |
10739 } else { | 10739 } else { |
10740 it.rinfo()->apply(delta, SKIP_ICACHE_FLUSH); | 10740 it.rinfo()->apply(delta, SKIP_ICACHE_FLUSH); |
10741 } | 10741 } |
10742 } | 10742 } |
10743 CPU::FlushICache(instruction_start(), instruction_size()); | 10743 CpuFeatures::FlushICache(instruction_start(), instruction_size()); |
10744 } | 10744 } |
10745 | 10745 |
10746 | 10746 |
10747 // Locate the source position which is closest to the address in the code. This | 10747 // Locate the source position which is closest to the address in the code. This |
10748 // is using the source position information embedded in the relocation info. | 10748 // is using the source position information embedded in the relocation info. |
10749 // The position returned is relative to the beginning of the script where the | 10749 // The position returned is relative to the beginning of the script where the |
10750 // source for this function is found. | 10750 // source for this function is found. |
10751 int Code::SourcePosition(Address pc) { | 10751 int Code::SourcePosition(Address pc) { |
10752 int distance = kMaxInt; | 10752 int distance = kMaxInt; |
10753 int position = RelocInfo::kNoPosition; // Initially no position found. | 10753 int position = RelocInfo::kNoPosition; // Initially no position found. |
(...skipping 4319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15073 array->set(index, cast_value); | 15073 array->set(index, cast_value); |
15074 } | 15074 } |
15075 return array->GetIsolate()->factory()->NewNumberFromUint(cast_value); | 15075 return array->GetIsolate()->factory()->NewNumberFromUint(cast_value); |
15076 } | 15076 } |
15077 | 15077 |
15078 | 15078 |
15079 Handle<Object> ExternalFloat32Array::SetValue( | 15079 Handle<Object> ExternalFloat32Array::SetValue( |
15080 Handle<ExternalFloat32Array> array, | 15080 Handle<ExternalFloat32Array> array, |
15081 uint32_t index, | 15081 uint32_t index, |
15082 Handle<Object> value) { | 15082 Handle<Object> value) { |
15083 float cast_value = static_cast<float>(OS::nan_value()); | 15083 float cast_value = static_cast<float>(base::OS::nan_value()); |
15084 if (index < static_cast<uint32_t>(array->length())) { | 15084 if (index < static_cast<uint32_t>(array->length())) { |
15085 if (value->IsSmi()) { | 15085 if (value->IsSmi()) { |
15086 int int_value = Handle<Smi>::cast(value)->value(); | 15086 int int_value = Handle<Smi>::cast(value)->value(); |
15087 cast_value = static_cast<float>(int_value); | 15087 cast_value = static_cast<float>(int_value); |
15088 } else if (value->IsHeapNumber()) { | 15088 } else if (value->IsHeapNumber()) { |
15089 double double_value = Handle<HeapNumber>::cast(value)->value(); | 15089 double double_value = Handle<HeapNumber>::cast(value)->value(); |
15090 cast_value = static_cast<float>(double_value); | 15090 cast_value = static_cast<float>(double_value); |
15091 } else { | 15091 } else { |
15092 // Clamp undefined to NaN (default). All other types have been | 15092 // Clamp undefined to NaN (default). All other types have been |
15093 // converted to a number type further up in the call chain. | 15093 // converted to a number type further up in the call chain. |
15094 ASSERT(value->IsUndefined()); | 15094 ASSERT(value->IsUndefined()); |
15095 } | 15095 } |
15096 array->set(index, cast_value); | 15096 array->set(index, cast_value); |
15097 } | 15097 } |
15098 return array->GetIsolate()->factory()->NewNumber(cast_value); | 15098 return array->GetIsolate()->factory()->NewNumber(cast_value); |
15099 } | 15099 } |
15100 | 15100 |
15101 | 15101 |
15102 Handle<Object> ExternalFloat64Array::SetValue( | 15102 Handle<Object> ExternalFloat64Array::SetValue( |
15103 Handle<ExternalFloat64Array> array, | 15103 Handle<ExternalFloat64Array> array, |
15104 uint32_t index, | 15104 uint32_t index, |
15105 Handle<Object> value) { | 15105 Handle<Object> value) { |
15106 double double_value = OS::nan_value(); | 15106 double double_value = base::OS::nan_value(); |
15107 if (index < static_cast<uint32_t>(array->length())) { | 15107 if (index < static_cast<uint32_t>(array->length())) { |
15108 if (value->IsNumber()) { | 15108 if (value->IsNumber()) { |
15109 double_value = value->Number(); | 15109 double_value = value->Number(); |
15110 } else { | 15110 } else { |
15111 // Clamp undefined to NaN (default). All other types have been | 15111 // Clamp undefined to NaN (default). All other types have been |
15112 // converted to a number type further up in the call chain. | 15112 // converted to a number type further up in the call chain. |
15113 ASSERT(value->IsUndefined()); | 15113 ASSERT(value->IsUndefined()); |
15114 } | 15114 } |
15115 array->set(index, double_value); | 15115 array->set(index, double_value); |
15116 } | 15116 } |
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16940 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16940 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16941 static const char* error_messages_[] = { | 16941 static const char* error_messages_[] = { |
16942 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16942 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16943 }; | 16943 }; |
16944 #undef ERROR_MESSAGES_TEXTS | 16944 #undef ERROR_MESSAGES_TEXTS |
16945 return error_messages_[reason]; | 16945 return error_messages_[reason]; |
16946 } | 16946 } |
16947 | 16947 |
16948 | 16948 |
16949 } } // namespace v8::internal | 16949 } } // namespace v8::internal |
OLD | NEW |