summaryrefslogtreecommitdiff
path: root/deps/v8/src/runtime.cc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2009-10-07 11:53:03 +0200
committerRyan Dahl <ry@tinyclouds.org>2009-10-07 11:53:45 +0200
commit1f31a7dbfe792fa6eee8a9cdcdfd662aad5cde06 (patch)
treec83b724056517e4bf71f203b74ad1d832d0ca7f0 /deps/v8/src/runtime.cc
parent1a2762b78e496dac4cc9fd0fb4ffb1d4f036692b (diff)
downloadnode-new-1f31a7dbfe792fa6eee8a9cdcdfd662aad5cde06.tar.gz
Upgrade v8 to 1.3.14
Diffstat (limited to 'deps/v8/src/runtime.cc')
-rw-r--r--deps/v8/src/runtime.cc40
1 files changed, 16 insertions, 24 deletions
diff --git a/deps/v8/src/runtime.cc b/deps/v8/src/runtime.cc
index 06b61e7bcb..4e1940d81a 100644
--- a/deps/v8/src/runtime.cc
+++ b/deps/v8/src/runtime.cc
@@ -3020,8 +3020,20 @@ static Object* Runtime_LocalKeys(Arguments args) {
// Some fast paths through GetKeysInFixedArrayFor reuse a cached
// property array and since the result is mutable we have to create
// a fresh clone on each invocation.
- Handle<FixedArray> copy = Factory::NewFixedArray(contents->length());
- contents->CopyTo(0, *copy, 0, contents->length());
+ int length = contents->length();
+ Handle<FixedArray> copy = Factory::NewFixedArray(length);
+ for (int i = 0; i < length; i++) {
+ Object* entry = contents->get(i);
+ if (entry->IsString()) {
+ copy->set(i, entry);
+ } else {
+ ASSERT(entry->IsNumber());
+ HandleScope scope;
+ Handle<Object> entry_handle(entry);
+ Handle<Object> entry_str = Factory::NumberToString(entry_handle);
+ copy->set(i, *entry_str);
+ }
+ }
return *Factory::NewJSArrayWithElements(copy);
}
@@ -3587,27 +3599,7 @@ static Object* Runtime_NumberToString(Arguments args) {
Object* number = args[0];
RUNTIME_ASSERT(number->IsNumber());
- Object* cached = Heap::GetNumberStringCache(number);
- if (cached != Heap::undefined_value()) {
- return cached;
- }
-
- char arr[100];
- Vector<char> buffer(arr, ARRAY_SIZE(arr));
- const char* str;
- if (number->IsSmi()) {
- int num = Smi::cast(number)->value();
- str = IntToCString(num, buffer);
- } else {
- double num = HeapNumber::cast(number)->value();
- str = DoubleToCString(num, buffer);
- }
- Object* result = Heap::AllocateStringFromAscii(CStrVector(str));
-
- if (!result->IsFailure()) {
- Heap::SetNumberStringCache(number, String::cast(result));
- }
- return result;
+ return Heap::NumberToString(number);
}
@@ -7148,7 +7140,7 @@ static Object* Runtime_DebugEvaluate(Arguments args) {
// the function being debugged.
// function(arguments,__source__) {return eval(__source__);}
static const char* source_str =
- "function(arguments,__source__){return eval(__source__);}";
+ "(function(arguments,__source__){return eval(__source__);})";
static const int source_str_length = strlen(source_str);
Handle<String> function_source =
Factory::NewStringFromAscii(Vector<const char>(source_str,