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

Side by Side Diff: src/runtime/runtime-array.cc

Issue 958053003: Removed funky Maybe constructor and made fields private. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-debug.cc » ('j') | 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/runtime/runtime-utils.h" 8 #include "src/runtime/runtime-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 indices); 437 indices);
438 } 438 }
439 } 439 }
440 440
441 441
442 static bool IterateElementsSlow(Isolate* isolate, Handle<JSObject> receiver, 442 static bool IterateElementsSlow(Isolate* isolate, Handle<JSObject> receiver,
443 uint32_t length, ArrayConcatVisitor* visitor) { 443 uint32_t length, ArrayConcatVisitor* visitor) {
444 for (uint32_t i = 0; i < length; ++i) { 444 for (uint32_t i = 0; i < length; ++i) {
445 HandleScope loop_scope(isolate); 445 HandleScope loop_scope(isolate);
446 Maybe<bool> maybe = JSReceiver::HasElement(receiver, i); 446 Maybe<bool> maybe = JSReceiver::HasElement(receiver, i);
447 if (!maybe.has_value) return false; 447 if (!maybe.IsJust()) return false;
448 if (maybe.value) { 448 if (maybe.FromJust()) {
449 Handle<Object> element_value; 449 Handle<Object> element_value;
450 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 450 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
451 isolate, element_value, 451 isolate, element_value,
452 Runtime::GetElementOrCharAt(isolate, receiver, i), false); 452 Runtime::GetElementOrCharAt(isolate, receiver, i), false);
453 visitor->visit(i, element_value); 453 visitor->visit(i, element_value);
454 } 454 }
455 } 455 }
456 visitor->increase_index_offset(length); 456 visitor->increase_index_offset(length);
457 return true; 457 return true;
458 } 458 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 Handle<FixedArray> elements(FixedArray::cast(receiver->elements())); 504 Handle<FixedArray> elements(FixedArray::cast(receiver->elements()));
505 int fast_length = static_cast<int>(length); 505 int fast_length = static_cast<int>(length);
506 DCHECK(fast_length <= elements->length()); 506 DCHECK(fast_length <= elements->length());
507 for (int j = 0; j < fast_length; j++) { 507 for (int j = 0; j < fast_length; j++) {
508 HandleScope loop_scope(isolate); 508 HandleScope loop_scope(isolate);
509 Handle<Object> element_value(elements->get(j), isolate); 509 Handle<Object> element_value(elements->get(j), isolate);
510 if (!element_value->IsTheHole()) { 510 if (!element_value->IsTheHole()) {
511 visitor->visit(j, element_value); 511 visitor->visit(j, element_value);
512 } else { 512 } else {
513 Maybe<bool> maybe = JSReceiver::HasElement(receiver, j); 513 Maybe<bool> maybe = JSReceiver::HasElement(receiver, j);
514 if (!maybe.has_value) return false; 514 if (!maybe.IsJust()) return false;
515 if (maybe.value) { 515 if (maybe.FromJust()) {
516 // Call GetElement on receiver, not its prototype, or getters won't 516 // Call GetElement on receiver, not its prototype, or getters won't
517 // have the correct receiver. 517 // have the correct receiver.
518 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 518 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
519 isolate, element_value, 519 isolate, element_value,
520 Object::GetElement(isolate, receiver, j), false); 520 Object::GetElement(isolate, receiver, j), false);
521 visitor->visit(j, element_value); 521 visitor->visit(j, element_value);
522 } 522 }
523 } 523 }
524 } 524 }
525 break; 525 break;
(...skipping 14 matching lines...) Expand all
540 DCHECK(fast_length <= elements->length()); 540 DCHECK(fast_length <= elements->length());
541 for (int j = 0; j < fast_length; j++) { 541 for (int j = 0; j < fast_length; j++) {
542 HandleScope loop_scope(isolate); 542 HandleScope loop_scope(isolate);
543 if (!elements->is_the_hole(j)) { 543 if (!elements->is_the_hole(j)) {
544 double double_value = elements->get_scalar(j); 544 double double_value = elements->get_scalar(j);
545 Handle<Object> element_value = 545 Handle<Object> element_value =
546 isolate->factory()->NewNumber(double_value); 546 isolate->factory()->NewNumber(double_value);
547 visitor->visit(j, element_value); 547 visitor->visit(j, element_value);
548 } else { 548 } else {
549 Maybe<bool> maybe = JSReceiver::HasElement(receiver, j); 549 Maybe<bool> maybe = JSReceiver::HasElement(receiver, j);
550 if (!maybe.has_value) return false; 550 if (!maybe.IsJust()) return false;
551 if (maybe.value) { 551 if (maybe.FromJust()) {
552 // Call GetElement on receiver, not its prototype, or getters won't 552 // Call GetElement on receiver, not its prototype, or getters won't
553 // have the correct receiver. 553 // have the correct receiver.
554 Handle<Object> element_value; 554 Handle<Object> element_value;
555 ASSIGN_RETURN_ON_EXCEPTION_VALUE( 555 ASSIGN_RETURN_ON_EXCEPTION_VALUE(
556 isolate, element_value, 556 isolate, element_value,
557 Object::GetElement(isolate, receiver, j), false); 557 Object::GetElement(isolate, receiver, j), false);
558 visitor->visit(j, element_value); 558 visitor->visit(j, element_value);
559 } 559 }
560 } 560 }
561 } 561 }
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 } 1310 }
1311 1311
1312 1312
1313 RUNTIME_FUNCTION(RuntimeReference_FastOneByteArrayJoin) { 1313 RUNTIME_FUNCTION(RuntimeReference_FastOneByteArrayJoin) {
1314 SealHandleScope shs(isolate); 1314 SealHandleScope shs(isolate);
1315 DCHECK(args.length() == 2); 1315 DCHECK(args.length() == 2);
1316 return isolate->heap()->undefined_value(); 1316 return isolate->heap()->undefined_value();
1317 } 1317 }
1318 } 1318 }
1319 } // namespace v8::internal 1319 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698