Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/objects.cc

Issue 1153373003: Add new Float32x4 type for SIMD.js. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 92
93 bool Object::BooleanValue() { 93 bool Object::BooleanValue() {
94 if (IsBoolean()) return IsTrue(); 94 if (IsBoolean()) return IsTrue();
95 if (IsSmi()) return Smi::cast(this)->value() != 0; 95 if (IsSmi()) return Smi::cast(this)->value() != 0;
96 if (IsUndefined() || IsNull()) return false; 96 if (IsUndefined() || IsNull()) return false;
97 if (IsUndetectableObject()) return false; // Undetectable object is false. 97 if (IsUndetectableObject()) return false; // Undetectable object is false.
98 if (IsString()) return String::cast(this)->length() != 0; 98 if (IsString()) return String::cast(this)->length() != 0;
99 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue(); 99 if (IsHeapNumber()) return HeapNumber::cast(this)->HeapNumberBooleanValue();
100 if (IsFloat32x4()) return true; // Simd value types always evaluate to true.
100 return true; 101 return true;
101 } 102 }
102 103
103 104
104 bool Object::IsCallable() const { 105 bool Object::IsCallable() const {
105 const Object* fun = this; 106 const Object* fun = this;
106 while (fun->IsJSFunctionProxy()) { 107 while (fun->IsJSFunctionProxy()) {
107 fun = JSFunctionProxy::cast(fun)->call_trap(); 108 fun = JSFunctionProxy::cast(fun)->call_trap();
108 } 109 }
109 return fun->IsJSFunction() || 110 return fun->IsJSFunction() ||
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 HeapNumber::cast(this)->HeapNumberPrint(os); 1394 HeapNumber::cast(this)->HeapNumberPrint(os);
1394 os << ">"; 1395 os << ">";
1395 break; 1396 break;
1396 } 1397 }
1397 case MUTABLE_HEAP_NUMBER_TYPE: { 1398 case MUTABLE_HEAP_NUMBER_TYPE: {
1398 os << "<MutableNumber: "; 1399 os << "<MutableNumber: ";
1399 HeapNumber::cast(this)->HeapNumberPrint(os); 1400 HeapNumber::cast(this)->HeapNumberPrint(os);
1400 os << '>'; 1401 os << '>';
1401 break; 1402 break;
1402 } 1403 }
1404 case FLOAT32X4_TYPE: {
1405 os << "<Float32x4: ";
1406 Float32x4::cast(this)->Float32x4Print(os);
1407 os << ">";
1408 break;
1409 }
1403 case JS_PROXY_TYPE: 1410 case JS_PROXY_TYPE:
1404 os << "<JSProxy>"; 1411 os << "<JSProxy>";
1405 break; 1412 break;
1406 case JS_FUNCTION_PROXY_TYPE: 1413 case JS_FUNCTION_PROXY_TYPE:
1407 os << "<JSFunctionProxy>"; 1414 os << "<JSFunctionProxy>";
1408 break; 1415 break;
1409 case FOREIGN_TYPE: 1416 case FOREIGN_TYPE:
1410 os << "<Foreign>"; 1417 os << "<Foreign>";
1411 break; 1418 break;
1412 case CELL_TYPE: { 1419 case CELL_TYPE: {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 break; 1543 break;
1537 case WEAK_CELL_TYPE: 1544 case WEAK_CELL_TYPE:
1538 WeakCell::BodyDescriptor::IterateBody(this, v); 1545 WeakCell::BodyDescriptor::IterateBody(this, v);
1539 break; 1546 break;
1540 case SYMBOL_TYPE: 1547 case SYMBOL_TYPE:
1541 Symbol::BodyDescriptor::IterateBody(this, v); 1548 Symbol::BodyDescriptor::IterateBody(this, v);
1542 break; 1549 break;
1543 1550
1544 case HEAP_NUMBER_TYPE: 1551 case HEAP_NUMBER_TYPE:
1545 case MUTABLE_HEAP_NUMBER_TYPE: 1552 case MUTABLE_HEAP_NUMBER_TYPE:
1553 case FLOAT32X4_TYPE:
1546 case FILLER_TYPE: 1554 case FILLER_TYPE:
1547 case BYTE_ARRAY_TYPE: 1555 case BYTE_ARRAY_TYPE:
1548 case FREE_SPACE_TYPE: 1556 case FREE_SPACE_TYPE:
1549 break; 1557 break;
1550 1558
1551 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ 1559 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
1552 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ 1560 case EXTERNAL_##TYPE##_ARRAY_TYPE: \
1553 case FIXED_##TYPE##_ARRAY_TYPE: \ 1561 case FIXED_##TYPE##_ARRAY_TYPE: \
1554 break; 1562 break;
1555 1563
(...skipping 25 matching lines...) Expand all
1581 bool HeapNumber::HeapNumberBooleanValue() { 1589 bool HeapNumber::HeapNumberBooleanValue() {
1582 return DoubleToBoolean(value()); 1590 return DoubleToBoolean(value());
1583 } 1591 }
1584 1592
1585 1593
1586 void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT 1594 void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT
1587 os << value(); 1595 os << value();
1588 } 1596 }
1589 1597
1590 1598
1599 void Float32x4::Float32x4Print(std::ostream& os) { // NOLINT
1600 os << get_lane(0) << ", " << get_lane(1) << ", " << get_lane(2) << ", "
1601 << get_lane(3);
1602 }
1603
1604
1591 String* JSReceiver::class_name() { 1605 String* JSReceiver::class_name() {
1592 if (IsJSFunction() || IsJSFunctionProxy()) { 1606 if (IsJSFunction() || IsJSFunctionProxy()) {
1593 return GetHeap()->Function_string(); 1607 return GetHeap()->Function_string();
1594 } 1608 }
1595 Object* maybe_constructor = map()->GetConstructor(); 1609 Object* maybe_constructor = map()->GetConstructor();
1596 if (maybe_constructor->IsJSFunction()) { 1610 if (maybe_constructor->IsJSFunction()) {
1597 JSFunction* constructor = JSFunction::cast(maybe_constructor); 1611 JSFunction* constructor = JSFunction::cast(maybe_constructor);
1598 return String::cast(constructor->shared()->instance_class_name()); 1612 return String::cast(constructor->shared()->instance_class_name());
1599 } 1613 }
1600 // If the constructor is not present, return "Object". 1614 // If the constructor is not present, return "Object".
(...skipping 15351 matching lines...) Expand 10 before | Expand all | Expand 10 after
16952 Handle<Object> new_value) { 16966 Handle<Object> new_value) {
16953 if (cell->value() != *new_value) { 16967 if (cell->value() != *new_value) {
16954 cell->set_value(*new_value); 16968 cell->set_value(*new_value);
16955 Isolate* isolate = cell->GetIsolate(); 16969 Isolate* isolate = cell->GetIsolate();
16956 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16970 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16957 isolate, DependentCode::kPropertyCellChangedGroup); 16971 isolate, DependentCode::kPropertyCellChangedGroup);
16958 } 16972 }
16959 } 16973 }
16960 } // namespace internal 16974 } // namespace internal
16961 } // namespace v8 16975 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | test/cctest/test-heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698