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

Side by Side Diff: test/cctest/compiler/test-simplified-lowering.cc

Issue 459763002: Fix size_t/int conversions for Win64. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 <limits> 5 #include <limits>
6 6
7 #include "src/compiler/control-builders.h" 7 #include "src/compiler/control-builders.h"
8 #include "src/compiler/generic-node-inl.h" 8 #include "src/compiler/generic-node-inl.h"
9 #include "src/compiler/graph-visualizer.h" 9 #include "src/compiler/graph-visualizer.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 size_t num_elements; 368 size_t num_elements;
369 E* untagged_array; 369 E* untagged_array;
370 Handle<ByteArray> tagged_array; // TODO(titzer): use FixedArray for tagged. 370 Handle<ByteArray> tagged_array; // TODO(titzer): use FixedArray for tagged.
371 371
372 AccessTester(bool t, MachineRepresentation r, E* orig, size_t num) 372 AccessTester(bool t, MachineRepresentation r, E* orig, size_t num)
373 : tagged(t), 373 : tagged(t),
374 rep(r), 374 rep(r),
375 original_elements(orig), 375 original_elements(orig),
376 num_elements(num), 376 num_elements(num),
377 untagged_array(static_cast<E*>(malloc(ByteSize()))), 377 untagged_array(static_cast<E*>(malloc(ByteSize()))),
378 tagged_array(main_isolate()->factory()->NewByteArray(ByteSize())) { 378 tagged_array(main_isolate()->factory()->NewByteArray(
379 static_cast<int>(ByteSize()))) {
379 Reinitialize(); 380 Reinitialize();
380 } 381 }
381 382
382 ~AccessTester() { free(untagged_array); } 383 ~AccessTester() { free(untagged_array); }
383 384
384 size_t ByteSize() { return num_elements * sizeof(E); } 385 size_t ByteSize() { return num_elements * sizeof(E); }
385 386
386 // Nuke both {untagged_array} and {tagged_array} with {original_elements}. 387 // Nuke both {untagged_array} and {tagged_array} with {original_elements}.
387 void Reinitialize() { 388 void Reinitialize() {
388 memcpy(untagged_array, original_elements, ByteSize()); 389 memcpy(untagged_array, original_elements, ByteSize());
389 CHECK_EQ(ByteSize(), tagged_array->length()); 390 CHECK_EQ(static_cast<int>(ByteSize()), tagged_array->length());
390 E* raw = reinterpret_cast<E*>(tagged_array->GetDataStartAddress()); 391 E* raw = reinterpret_cast<E*>(tagged_array->GetDataStartAddress());
391 memcpy(raw, original_elements, ByteSize()); 392 memcpy(raw, original_elements, ByteSize());
392 } 393 }
393 394
394 // Create and run code that copies the element in either {untagged_array} 395 // Create and run code that copies the element in either {untagged_array}
395 // or {tagged_array} at index {from_index} to index {to_index}. 396 // or {tagged_array} at index {from_index} to index {to_index}.
396 void RunCopyElement(int from_index, int to_index) { 397 void RunCopyElement(int from_index, int to_index) {
397 // TODO(titzer): test element and field accesses where the base is not 398 // TODO(titzer): test element and field accesses where the base is not
398 // a constant in the code. 399 // a constant in the code.
399 BoundsCheck(from_index); 400 BoundsCheck(from_index);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 504
504 template <typename T> 505 template <typename T>
505 Node* GetBaseNode(SimplifiedLoweringTester<T>* t) { 506 Node* GetBaseNode(SimplifiedLoweringTester<T>* t) {
506 return tagged ? t->HeapConstant(tagged_array) 507 return tagged ? t->HeapConstant(tagged_array)
507 : t->PointerConstant(untagged_array); 508 : t->PointerConstant(untagged_array);
508 } 509 }
509 510
510 void BoundsCheck(int index) { 511 void BoundsCheck(int index) {
511 CHECK_GE(index, 0); 512 CHECK_GE(index, 0);
512 CHECK_LT(index, static_cast<int>(num_elements)); 513 CHECK_LT(index, static_cast<int>(num_elements));
513 CHECK_EQ(ByteSize(), tagged_array->length()); 514 CHECK_EQ(static_cast<int>(ByteSize()), tagged_array->length());
514 } 515 }
515 }; 516 };
516 517
517 518
518 template <typename E> 519 template <typename E>
519 static void RunAccessTest(MachineRepresentation rep, E* original_elements, 520 static void RunAccessTest(MachineRepresentation rep, E* original_elements,
520 size_t num) { 521 size_t num) {
521 int num_elements = static_cast<int>(num); 522 int num_elements = static_cast<int>(num);
522 523
523 for (int taggedness = 0; taggedness < 2; taggedness++) { 524 for (int taggedness = 0; taggedness < 2; taggedness++) {
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 1364
1364 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, 1365 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
1365 t.p1, t.start, t.start); 1366 t.p1, t.start, t.start);
1366 t.Effect(store); 1367 t.Effect(store);
1367 t.Lower(); 1368 t.Lower();
1368 1369
1369 CHECK_EQ(IrOpcode::kStore, store->opcode()); 1370 CHECK_EQ(IrOpcode::kStore, store->opcode());
1370 CHECK_EQ(t.p0, store->InputAt(0)); 1371 CHECK_EQ(t.p0, store->InputAt(0));
1371 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); 1372 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2));
1372 } 1373 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698