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

Unified Diff: src/api.cc

Issue 1160443009: Add SIMD.Float32x4 functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tests working. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 3b2c9909bb8e537c09fed4fdd8cb26881dea3b58..d6ca6095b3c2cfa5c7a9a396fcfd429a7868a880 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2702,6 +2702,11 @@ bool Value::IsSymbol() const {
}
+bool Value::IsFloat32x4() const {
+ return Utils::OpenHandle(this)->IsFloat32x4();
+}
+
+
bool Value::IsArray() const {
return Utils::OpenHandle(this)->IsJSArray();
}
@@ -2770,6 +2775,7 @@ VALUE_IS_SPECIFIC_TYPE(BooleanObject, Boolean)
VALUE_IS_SPECIFIC_TYPE(NumberObject, Number)
VALUE_IS_SPECIFIC_TYPE(StringObject, String)
VALUE_IS_SPECIFIC_TYPE(SymbolObject, Symbol)
+VALUE_IS_SPECIFIC_TYPE(Float32x4Object, Float32x4)
VALUE_IS_SPECIFIC_TYPE(Date, Date)
VALUE_IS_SPECIFIC_TYPE(Map, Map)
VALUE_IS_SPECIFIC_TYPE(Set, Set)
@@ -3071,6 +3077,13 @@ void v8::Symbol::CheckCast(v8::Value* that) {
}
+void v8::Float32x4::CheckCast(v8::Value* that) {
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
+ Utils::ApiCheck(obj->IsFloat32x4(), "v8::Float32x4::Cast()",
+ "Could not convert to float32x4");
+}
+
+
void v8::Number::CheckCast(v8::Value* that) {
i::Handle<i::Object> obj = Utils::OpenHandle(that);
Utils::ApiCheck(obj->IsNumber(),
@@ -3224,6 +3237,17 @@ void v8::SymbolObject::CheckCast(v8::Value* that) {
}
+void v8::Float32x4Object::CheckCast(v8::Value* that) {
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
+ i::Isolate* isolate = NULL;
+ if (obj->IsHeapObject()) isolate = i::HeapObject::cast(*obj)->GetIsolate();
+ Utils::ApiCheck(
+ isolate != NULL &&
+ obj->HasSpecificClassOf(isolate->heap()->Float32x4_string()),
+ "v8::Float32x4Object::Cast()", "Could not convert to Float32x4Object");
+}
+
+
void v8::NumberObject::CheckCast(v8::Value* that) {
i::Handle<i::Object> obj = Utils::OpenHandle(that);
i::Isolate* isolate = NULL;
@@ -6096,6 +6120,28 @@ Local<v8::Symbol> v8::SymbolObject::ValueOf() const {
}
+Local<v8::Value> v8::Float32x4Object::New(Isolate* isolate,
+ Handle<Float32x4> value) {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ LOG_API(i_isolate, "Float32x4Object::New");
+ ENTER_V8(i_isolate);
+ i::Handle<i::Object> obj =
+ i::Object::ToObject(i_isolate, Utils::OpenHandle(*value))
+ .ToHandleChecked();
+ return Utils::ToLocal(obj);
+}
+
+
+Local<v8::Float32x4> v8::Float32x4Object::ValueOf() const {
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
+ i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
+ i::Isolate* isolate = jsvalue->GetIsolate();
+ LOG_API(isolate, "Float32x4Object::Float32Value");
+ return Utils::ToLocal(
+ i::Handle<i::Float32x4>(i::Float32x4::cast(jsvalue->value())));
+}
+
+
MaybeLocal<v8::Value> v8::Date::New(Local<Context> context, double time) {
if (std::isnan(time)) {
// Introduce only canonical NaN value into the VM, to avoid signaling NaNs.
@@ -6947,6 +6993,17 @@ Local<Symbol> v8::Symbol::GetToStringTag(Isolate* isolate) {
}
+Local<Float32x4> v8::Float32x4::New(Isolate* isolate, float w, float x, float y,
+ float z) {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ LOG_API(i_isolate, "Float32x4::New()");
+ ENTER_V8(i_isolate);
+ i::Handle<i::Float32x4> result =
+ i_isolate->factory()->NewFloat32x4(w, x, y, z);
+ return Utils::ToLocal(result);
+}
+
+
Local<Number> v8::Number::New(Isolate* isolate, double value) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
if (std::isnan(value)) {
« no previous file with comments | « src/api.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698