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

Side by Side Diff: src/objects.cc

Issue 1219943002: Expose SIMD.Float32x4 type to Javascript. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object); 74 if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object);
75 Handle<JSFunction> constructor; 75 Handle<JSFunction> constructor;
76 if (object->IsNumber()) { 76 if (object->IsNumber()) {
77 constructor = handle(native_context->number_function(), isolate); 77 constructor = handle(native_context->number_function(), isolate);
78 } else if (object->IsBoolean()) { 78 } else if (object->IsBoolean()) {
79 constructor = handle(native_context->boolean_function(), isolate); 79 constructor = handle(native_context->boolean_function(), isolate);
80 } else if (object->IsString()) { 80 } else if (object->IsString()) {
81 constructor = handle(native_context->string_function(), isolate); 81 constructor = handle(native_context->string_function(), isolate);
82 } else if (object->IsSymbol()) { 82 } else if (object->IsSymbol()) {
83 constructor = handle(native_context->symbol_function(), isolate); 83 constructor = handle(native_context->symbol_function(), isolate);
84 } else if (object->IsFloat32x4()) {
85 constructor = handle(native_context->float32x4_function(), isolate);
84 } else { 86 } else {
85 return MaybeHandle<JSReceiver>(); 87 return MaybeHandle<JSReceiver>();
86 } 88 }
87 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor); 89 Handle<JSObject> result = isolate->factory()->NewJSObject(constructor);
88 Handle<JSValue>::cast(result)->set_value(*object); 90 Handle<JSValue>::cast(result)->set_value(*object);
89 return result; 91 return result;
90 } 92 }
91 93
92 94
93 bool Object::BooleanValue() { 95 bool Object::BooleanValue() {
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 605
604 Map* Object::GetRootMap(Isolate* isolate) { 606 Map* Object::GetRootMap(Isolate* isolate) {
605 DisallowHeapAllocation no_alloc; 607 DisallowHeapAllocation no_alloc;
606 if (IsSmi()) { 608 if (IsSmi()) {
607 Context* context = isolate->context()->native_context(); 609 Context* context = isolate->context()->native_context();
608 return context->number_function()->initial_map(); 610 return context->number_function()->initial_map();
609 } 611 }
610 612
611 HeapObject* heap_object = HeapObject::cast(this); 613 HeapObject* heap_object = HeapObject::cast(this);
612 614
613 // The object is either a number, a string, a boolean, 615 // The object is either a number, a string, a symbol, a boolean, a SIMD value,
614 // a real JS object, or a Harmony proxy. 616 // a real JS object, or a Harmony proxy.
615 if (heap_object->IsJSReceiver()) { 617 if (heap_object->IsJSReceiver()) {
616 return heap_object->map(); 618 return heap_object->map();
617 } 619 }
618 Context* context = isolate->context()->native_context(); 620 Context* context = isolate->context()->native_context();
619 621
620 if (heap_object->IsHeapNumber()) { 622 if (heap_object->IsHeapNumber()) {
621 return context->number_function()->initial_map(); 623 return context->number_function()->initial_map();
622 } 624 }
623 if (heap_object->IsString()) { 625 if (heap_object->IsString()) {
624 return context->string_function()->initial_map(); 626 return context->string_function()->initial_map();
625 } 627 }
626 if (heap_object->IsSymbol()) { 628 if (heap_object->IsSymbol()) {
627 return context->symbol_function()->initial_map(); 629 return context->symbol_function()->initial_map();
628 } 630 }
629 if (heap_object->IsBoolean()) { 631 if (heap_object->IsBoolean()) {
630 return context->boolean_function()->initial_map(); 632 return context->boolean_function()->initial_map();
631 } 633 }
634 if (heap_object->IsFloat32x4()) {
635 return context->float32x4_function()->initial_map();
636 }
632 return isolate->heap()->null_value()->map(); 637 return isolate->heap()->null_value()->map();
633 } 638 }
634 639
635 640
636 Object* Object::GetHash() { 641 Object* Object::GetHash() {
637 Object* hash = GetSimpleHash(); 642 Object* hash = GetSimpleHash();
638 if (hash->IsSmi()) return hash; 643 if (hash->IsSmi()) return hash;
639 644
640 DCHECK(IsJSReceiver()); 645 DCHECK(IsJSReceiver());
641 return JSReceiver::cast(this)->GetIdentityHash(); 646 return JSReceiver::cast(this)->GetIdentityHash();
(...skipping 15535 matching lines...) Expand 10 before | Expand all | Expand 10 after
16177 Handle<Object> new_value) { 16182 Handle<Object> new_value) {
16178 if (cell->value() != *new_value) { 16183 if (cell->value() != *new_value) {
16179 cell->set_value(*new_value); 16184 cell->set_value(*new_value);
16180 Isolate* isolate = cell->GetIsolate(); 16185 Isolate* isolate = cell->GetIsolate();
16181 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16186 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16182 isolate, DependentCode::kPropertyCellChangedGroup); 16187 isolate, DependentCode::kPropertyCellChangedGroup);
16183 } 16188 }
16184 } 16189 }
16185 } // namespace internal 16190 } // namespace internal
16186 } // namespace v8 16191 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698