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

Unified Diff: src/hydrogen.cc

Issue 66843011: Generate DataViewInitialize built-in in hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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/hydrogen.h ('k') | src/typedarray.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 591390231526124567d494905432b3a08cafd8b5..27fd055d43443824b8f0ee408d32667bc0b324c4 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -7920,6 +7920,52 @@ const HOptimizedGraphBuilder::InlineFunctionGenerator
#undef INLINE_FUNCTION_GENERATOR_ADDRESS
+void HOptimizedGraphBuilder::VisitDataViewInitialize(
+ CallRuntime* expr) {
+ ZoneList<Expression*>* arguments = expr->arguments();
+
+ NoObservableSideEffectsScope scope(this);
+ ASSERT(arguments->length()== 4);
+ CHECK_ALIVE(VisitForValue(arguments->at(0)));
+ HValue* obj = Pop();
+
+ CHECK_ALIVE(VisitForValue(arguments->at(1)));
+ HValue* buffer = Pop();
+
+ CHECK_ALIVE(VisitForValue(arguments->at(2)));
+ HValue* byte_offset = Pop();
+
+ CHECK_ALIVE(VisitForValue(arguments->at(3)));
+ HValue* byte_length = Pop();
+
+ for (int offset = JSDataView::kSize;
+ offset < JSDataView::kSizeWithInternalFields;
+ offset += kPointerSize) {
+ Add<HStoreNamedField>(obj,
+ HObjectAccess::ForJSObjectOffset(offset),
+ Add<HConstant>(static_cast<int32_t>(0)));
+ }
+
+ Add<HStoreNamedField>(obj,
+ HObjectAccess::ForJSObjectOffset(JSDataView::kBufferOffset), buffer);
+ Add<HStoreNamedField>(obj,
+ HObjectAccess::ForJSObjectOffset(JSDataView::kByteOffsetOffset),
+ byte_offset);
Benedikt Meurer 2013/11/18 08:02:31 byte_offset should be a SMI, so you should pass Re
Dmitry Lomov (no reviews) 2013/11/18 08:46:47 Byte offset is not neccessarily a smi here. Ditto
+ Add<HStoreNamedField>(obj,
+ HObjectAccess::ForJSObjectOffset(JSDataView::kByteLengthOffset),
Benedikt Meurer 2013/11/18 08:02:31 byte_length is a SMI, so you should pass Represent
+ byte_length);
+
+ Add<HStoreNamedField>(obj,
+ HObjectAccess::ForJSObjectOffset(JSDataView::kWeakNextOffset),
+ Add<HLoadNamedField>(buffer,
+ HObjectAccess::ForJSObjectOffset(
+ JSArrayBuffer::kWeakFirstViewOffset)));
+ Add<HStoreNamedField>(buffer,
+ HObjectAccess::ForJSObjectOffset(JSArrayBuffer::kWeakFirstViewOffset),
+ obj);
+}
+
+
void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
ASSERT(!HasStackOverflow());
ASSERT(current_block() != NULL);
@@ -7930,6 +7976,11 @@ void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
const Runtime::Function* function = expr->function();
ASSERT(function != NULL);
+
+ if (function->function_id == Runtime::kDataViewInitialize) {
+ return VisitDataViewInitialize(expr);
+ }
+
if (function->intrinsic_type == Runtime::INLINE) {
ASSERT(expr->name()->length() > 0);
ASSERT(expr->name()->Get(0) == '_');
« no previous file with comments | « src/hydrogen.h ('k') | src/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698