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

Side by Side Diff: src/api.cc

Issue 1153673003: Make delete API consistent for String objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | test/cctest/test-api.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 3463 matching lines...) Expand 10 before | Expand all | Expand 10 after
3474 // Check if the given key is an array index. 3474 // Check if the given key is an array index.
3475 uint32_t index; 3475 uint32_t index;
3476 if (key->ToArrayIndex(&index)) { 3476 if (key->ToArrayIndex(&index)) {
3477 // In Firefox/SpiderMonkey, Safari and Opera you can access the 3477 // In Firefox/SpiderMonkey, Safari and Opera you can access the
3478 // characters of a string using [] notation. In the case of a 3478 // characters of a string using [] notation. In the case of a
3479 // String object we just need to redirect the deletion to the 3479 // String object we just need to redirect the deletion to the
3480 // underlying string if the index is in range. Since the 3480 // underlying string if the index is in range. Since the
3481 // underlying string does nothing with the deletion, we can ignore 3481 // underlying string does nothing with the deletion, we can ignore
3482 // such deletions. 3482 // such deletions.
3483 if (receiver->IsStringObjectWithCharacterAt(index)) { 3483 if (receiver->IsStringObjectWithCharacterAt(index)) {
3484 return isolate->factory()->true_value(); 3484 return isolate->factory()->false_value();
3485 } 3485 }
3486 3486
3487 return i::JSReceiver::DeleteElement(receiver, index, language_mode); 3487 return i::JSReceiver::DeleteElement(receiver, index, language_mode);
3488 } 3488 }
3489 3489
3490 i::Handle<i::Name> name; 3490 i::Handle<i::Name> name;
3491 if (key->IsName()) { 3491 if (key->IsName()) {
3492 name = i::Handle<i::Name>::cast(key); 3492 name = i::Handle<i::Name>::cast(key);
3493 } else { 3493 } else {
3494 // Call-back into JavaScript to convert the key to a string. 3494 // Call-back into JavaScript to convert the key to a string.
(...skipping 4584 matching lines...) Expand 10 before | Expand all | Expand 10 after
8079 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8079 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8080 Address callback_address = 8080 Address callback_address =
8081 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8081 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8082 VMState<EXTERNAL> state(isolate); 8082 VMState<EXTERNAL> state(isolate);
8083 ExternalCallbackScope call_scope(isolate, callback_address); 8083 ExternalCallbackScope call_scope(isolate, callback_address);
8084 callback(info); 8084 callback(info);
8085 } 8085 }
8086 8086
8087 8087
8088 } } // namespace v8::internal 8088 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698