}
+Handle<Object> LookupSingleCharacterStringFromCode(uint32_t index) {
+ CALL_HEAP_FUNCTION(Heap::LookupSingleCharacterStringFromCode(index), Object);
+}
+
+
Handle<String> SubString(Handle<String> str, int start, int end) {
CALL_HEAP_FUNCTION(str->Slice(start, end), String);
}
Handle<Object> DeleteElement(Handle<JSObject> obj, uint32_t index);
Handle<Object> DeleteProperty(Handle<JSObject> obj, Handle<String> prop);
+Handle<Object> LookupSingleCharacterStringFromCode(uint32_t index);
+
Handle<JSObject> Copy(Handle<JSObject> obj, PretenureFlag = NOT_TENURED);
// Get the JS object corresponding to the given script; create it
// Returns a single character string where first character equals
// string->Get(index).
-static Object* GetCharAt(String* string, uint32_t index) {
+static Handle<Object> GetCharAt(Handle<String> string, uint32_t index) {
if (index < static_cast<uint32_t>(string->length())) {
string->TryFlatten();
- return Heap::LookupSingleCharacterStringFromCode(string->Get(index));
+ return LookupSingleCharacterStringFromCode(string->Get(index));
}
- return *Execution::CharAt(Handle<String>(string), index);
+ return Execution::CharAt(string, index);
}
Object* Runtime::GetElementOrCharAt(Handle<Object> object, uint32_t index) {
// Handle [] indexing on Strings
if (object->IsString()) {
- Object* result = GetCharAt(String::cast(*object), index);
- if (!result->IsUndefined()) return result;
+ Handle<Object> result = GetCharAt(Handle<String>::cast(object), index);
+ if (!result->IsUndefined()) return *result;
}
// Handle [] indexing on String objects
if (object->IsStringObjectWithCharacterAt(index)) {
- JSValue* js_value = JSValue::cast(*object);
- Object* result = GetCharAt(String::cast(js_value->value()), index);
- if (!result->IsUndefined()) return result;
+ Handle<JSValue> js_value = Handle<JSValue>::cast(object);
+ Handle<Object> result =
+ GetCharAt(Handle<String>(String::cast(js_value->value())), index);
+ if (!result->IsUndefined()) return *result;
}
if (object->IsString() || object->IsNumber() || object->IsBoolean()) {
- Object* prototype = object->GetPrototype();
+ Handle<Object> prototype = GetPrototype(object);
return prototype->GetElement(index);
}
+// Copyright 2008 Google Inc. All Rights Reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
var o = {"\u59cb\u53d1\u7ad9": 1};
assertEquals(1, o.\u59cb\u53d1\u7ad9);