| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // We can use external strings for the natives. | 79 // We can use external strings for the natives. |
| 80 Vector<const char> source = Natives::GetRawScriptSource(index); | 80 Vector<const char> source = Natives::GetRawScriptSource(index); |
| 81 NativesExternalStringResource* resource = | 81 NativesExternalStringResource* resource = |
| 82 new NativesExternalStringResource(this, | 82 new NativesExternalStringResource(this, |
| 83 source.start(), | 83 source.start(), |
| 84 source.length()); | 84 source.length()); |
| 85 Handle<String> source_code = | 85 Handle<String> source_code = |
| 86 isolate_->factory()->NewExternalStringFromAscii(resource); | 86 isolate_->factory()->NewExternalStringFromAscii(resource); |
| 87 heap->natives_source_cache()->set(index, *source_code); | 87 heap->natives_source_cache()->set(index, *source_code); |
| 88 } | 88 } |
| 89 Handle<Object> cached_source(heap->natives_source_cache()->get(index)); | 89 Handle<Object> cached_source(heap->natives_source_cache()->get(index), |
| 90 isolate_); |
| 90 return Handle<String>::cast(cached_source); | 91 return Handle<String>::cast(cached_source); |
| 91 } | 92 } |
| 92 | 93 |
| 93 | 94 |
| 94 void Bootstrapper::Initialize(bool create_heap_objects) { | 95 void Bootstrapper::Initialize(bool create_heap_objects) { |
| 95 extensions_cache_.Initialize(create_heap_objects); | 96 extensions_cache_.Initialize(create_heap_objects); |
| 96 GCExtension::Register(); | 97 GCExtension::Register(); |
| 97 ExternalizeStringExtension::Register(); | 98 ExternalizeStringExtension::Register(); |
| 98 StatisticsExtension::Register(); | 99 StatisticsExtension::Register(); |
| 99 } | 100 } |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 // Step 1: Create a fresh inner JSGlobalObject. | 716 // Step 1: Create a fresh inner JSGlobalObject. |
| 716 Handle<JSFunction> js_global_function; | 717 Handle<JSFunction> js_global_function; |
| 717 Handle<ObjectTemplateInfo> js_global_template; | 718 Handle<ObjectTemplateInfo> js_global_template; |
| 718 if (!global_template.IsEmpty()) { | 719 if (!global_template.IsEmpty()) { |
| 719 // Get prototype template of the global_template. | 720 // Get prototype template of the global_template. |
| 720 Handle<ObjectTemplateInfo> data = | 721 Handle<ObjectTemplateInfo> data = |
| 721 v8::Utils::OpenHandle(*global_template); | 722 v8::Utils::OpenHandle(*global_template); |
| 722 Handle<FunctionTemplateInfo> global_constructor = | 723 Handle<FunctionTemplateInfo> global_constructor = |
| 723 Handle<FunctionTemplateInfo>( | 724 Handle<FunctionTemplateInfo>( |
| 724 FunctionTemplateInfo::cast(data->constructor())); | 725 FunctionTemplateInfo::cast(data->constructor())); |
| 725 Handle<Object> proto_template(global_constructor->prototype_template()); | 726 Handle<Object> proto_template(global_constructor->prototype_template(), |
| 727 isolate()); |
| 726 if (!proto_template->IsUndefined()) { | 728 if (!proto_template->IsUndefined()) { |
| 727 js_global_template = | 729 js_global_template = |
| 728 Handle<ObjectTemplateInfo>::cast(proto_template); | 730 Handle<ObjectTemplateInfo>::cast(proto_template); |
| 729 } | 731 } |
| 730 } | 732 } |
| 731 | 733 |
| 732 if (js_global_template.is_null()) { | 734 if (js_global_template.is_null()) { |
| 733 Handle<String> name = Handle<String>(heap()->empty_symbol()); | 735 Handle<String> name = Handle<String>(heap()->empty_symbol()); |
| 734 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin( | 736 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin( |
| 735 Builtins::kIllegal)); | 737 Builtins::kIllegal)); |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 ? Handle<Context>(top_context->runtime_context()) | 1384 ? Handle<Context>(top_context->runtime_context()) |
| 1383 : top_context); | 1385 : top_context); |
| 1384 Handle<JSFunction> fun = | 1386 Handle<JSFunction> fun = |
| 1385 factory->NewFunctionFromSharedFunctionInfo(function_info, context); | 1387 factory->NewFunctionFromSharedFunctionInfo(function_info, context); |
| 1386 | 1388 |
| 1387 // Call function using either the runtime object or the global | 1389 // Call function using either the runtime object or the global |
| 1388 // object as the receiver. Provide no parameters. | 1390 // object as the receiver. Provide no parameters. |
| 1389 Handle<Object> receiver = | 1391 Handle<Object> receiver = |
| 1390 Handle<Object>(use_runtime_context | 1392 Handle<Object>(use_runtime_context |
| 1391 ? top_context->builtins() | 1393 ? top_context->builtins() |
| 1392 : top_context->global_object()); | 1394 : top_context->global_object(), |
| 1395 isolate); |
| 1393 bool has_pending_exception; | 1396 bool has_pending_exception; |
| 1394 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); | 1397 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); |
| 1395 if (has_pending_exception) return false; | 1398 if (has_pending_exception) return false; |
| 1396 return true; | 1399 return true; |
| 1397 } | 1400 } |
| 1398 | 1401 |
| 1399 | 1402 |
| 1400 #define INSTALL_NATIVE(Type, name, var) \ | 1403 #define INSTALL_NATIVE(Type, name, var) \ |
| 1401 Handle<String> var##_name = \ | 1404 Handle<String> var##_name = \ |
| 1402 factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR(name)); \ | 1405 factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR(name)); \ |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 builtins->set_global_receiver(*builtins); | 1528 builtins->set_global_receiver(*builtins); |
| 1526 | 1529 |
| 1527 // Set up the 'global' properties of the builtins object. The | 1530 // Set up the 'global' properties of the builtins object. The |
| 1528 // 'global' property that refers to the global object is the only | 1531 // 'global' property that refers to the global object is the only |
| 1529 // way to get from code running in the builtins context to the | 1532 // way to get from code running in the builtins context to the |
| 1530 // global object. | 1533 // global object. |
| 1531 static const PropertyAttributes attributes = | 1534 static const PropertyAttributes attributes = |
| 1532 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); | 1535 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); |
| 1533 Handle<String> global_symbol = | 1536 Handle<String> global_symbol = |
| 1534 factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("global")); | 1537 factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR("global")); |
| 1535 Handle<Object> global_obj(native_context()->global_object()); | 1538 Handle<Object> global_obj(native_context()->global_object(), isolate()); |
| 1536 CHECK_NOT_EMPTY_HANDLE(isolate(), | 1539 CHECK_NOT_EMPTY_HANDLE(isolate(), |
| 1537 JSObject::SetLocalPropertyIgnoreAttributes( | 1540 JSObject::SetLocalPropertyIgnoreAttributes( |
| 1538 builtins, global_symbol, global_obj, attributes)); | 1541 builtins, global_symbol, global_obj, attributes)); |
| 1539 | 1542 |
| 1540 // Set up the reference from the global object to the builtins object. | 1543 // Set up the reference from the global object to the builtins object. |
| 1541 JSGlobalObject::cast(native_context()->global_object())-> | 1544 JSGlobalObject::cast(native_context()->global_object())-> |
| 1542 set_builtins(*builtins); | 1545 set_builtins(*builtins); |
| 1543 | 1546 |
| 1544 // Create a bridge function that has context in the native context. | 1547 // Create a bridge function that has context in the native context. |
| 1545 Handle<JSFunction> bridge = | 1548 Handle<JSFunction> bridge = |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 // and the String function has been set up. | 1763 // and the String function has been set up. |
| 1761 Handle<JSFunction> string_function(native_context()->string_function()); | 1764 Handle<JSFunction> string_function(native_context()->string_function()); |
| 1762 ASSERT(JSObject::cast( | 1765 ASSERT(JSObject::cast( |
| 1763 string_function->initial_map()->prototype())->HasFastProperties()); | 1766 string_function->initial_map()->prototype())->HasFastProperties()); |
| 1764 native_context()->set_string_function_prototype_map( | 1767 native_context()->set_string_function_prototype_map( |
| 1765 HeapObject::cast(string_function->initial_map()->prototype())->map()); | 1768 HeapObject::cast(string_function->initial_map()->prototype())->map()); |
| 1766 | 1769 |
| 1767 // Install Function.prototype.call and apply. | 1770 // Install Function.prototype.call and apply. |
| 1768 { Handle<String> key = factory()->function_class_symbol(); | 1771 { Handle<String> key = factory()->function_class_symbol(); |
| 1769 Handle<JSFunction> function = | 1772 Handle<JSFunction> function = |
| 1770 Handle<JSFunction>::cast(GetProperty(isolate()->global_object(), key)); | 1773 Handle<JSFunction>::cast( |
| 1774 GetProperty(isolate(), isolate()->global_object(), key)); |
| 1771 Handle<JSObject> proto = | 1775 Handle<JSObject> proto = |
| 1772 Handle<JSObject>(JSObject::cast(function->instance_prototype())); | 1776 Handle<JSObject>(JSObject::cast(function->instance_prototype())); |
| 1773 | 1777 |
| 1774 // Install the call and the apply functions. | 1778 // Install the call and the apply functions. |
| 1775 Handle<JSFunction> call = | 1779 Handle<JSFunction> call = |
| 1776 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, | 1780 InstallFunction(proto, "call", JS_OBJECT_TYPE, JSObject::kHeaderSize, |
| 1777 Handle<JSObject>::null(), | 1781 Handle<JSObject>::null(), |
| 1778 Builtins::kFunctionCall, | 1782 Builtins::kFunctionCall, |
| 1779 false); | 1783 false); |
| 1780 Handle<JSFunction> apply = | 1784 Handle<JSFunction> apply = |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 | 1893 |
| 1890 InstallExperimentalNativeFunctions(); | 1894 InstallExperimentalNativeFunctions(); |
| 1891 | 1895 |
| 1892 return true; | 1896 return true; |
| 1893 } | 1897 } |
| 1894 | 1898 |
| 1895 | 1899 |
| 1896 static Handle<JSObject> ResolveBuiltinIdHolder( | 1900 static Handle<JSObject> ResolveBuiltinIdHolder( |
| 1897 Handle<Context> native_context, | 1901 Handle<Context> native_context, |
| 1898 const char* holder_expr) { | 1902 const char* holder_expr) { |
| 1899 Factory* factory = native_context->GetIsolate()->factory(); | 1903 Isolate* isolate = native_context->GetIsolate(); |
| 1904 Factory* factory = isolate->factory(); |
| 1900 Handle<GlobalObject> global(native_context->global_object()); | 1905 Handle<GlobalObject> global(native_context->global_object()); |
| 1901 const char* period_pos = strchr(holder_expr, '.'); | 1906 const char* period_pos = strchr(holder_expr, '.'); |
| 1902 if (period_pos == NULL) { | 1907 if (period_pos == NULL) { |
| 1903 return Handle<JSObject>::cast( | 1908 return Handle<JSObject>::cast( |
| 1904 GetProperty(global, factory->LookupUtf8Symbol(holder_expr))); | 1909 GetProperty(isolate, global, factory->LookupUtf8Symbol(holder_expr))); |
| 1905 } | 1910 } |
| 1906 ASSERT_EQ(".prototype", period_pos); | 1911 ASSERT_EQ(".prototype", period_pos); |
| 1907 Vector<const char> property(holder_expr, | 1912 Vector<const char> property(holder_expr, |
| 1908 static_cast<int>(period_pos - holder_expr)); | 1913 static_cast<int>(period_pos - holder_expr)); |
| 1909 Handle<JSFunction> function = Handle<JSFunction>::cast( | 1914 Handle<JSFunction> function = Handle<JSFunction>::cast( |
| 1910 GetProperty(global, factory->LookupUtf8Symbol(property))); | 1915 GetProperty(isolate, global, factory->LookupUtf8Symbol(property))); |
| 1911 return Handle<JSObject>(JSObject::cast(function->prototype())); | 1916 return Handle<JSObject>(JSObject::cast(function->prototype())); |
| 1912 } | 1917 } |
| 1913 | 1918 |
| 1914 | 1919 |
| 1915 static void InstallBuiltinFunctionId(Handle<JSObject> holder, | 1920 static void InstallBuiltinFunctionId(Handle<JSObject> holder, |
| 1916 const char* function_name, | 1921 const char* function_name, |
| 1917 BuiltinFunctionId id) { | 1922 BuiltinFunctionId id) { |
| 1918 Factory* factory = holder->GetIsolate()->factory(); | 1923 Factory* factory = holder->GetIsolate()->factory(); |
| 1919 Handle<String> name = factory->LookupUtf8Symbol(function_name); | 1924 Handle<String> name = factory->LookupUtf8Symbol(function_name); |
| 1920 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked(); | 1925 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2011 JSObject::SetLocalPropertyIgnoreAttributes( | 2016 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2012 global, natives, | 2017 global, natives, |
| 2013 Handle<JSObject>(global->builtins()), | 2018 Handle<JSObject>(global->builtins()), |
| 2014 DONT_ENUM)); | 2019 DONT_ENUM)); |
| 2015 } | 2020 } |
| 2016 | 2021 |
| 2017 Handle<Object> Error = GetProperty(global, "Error"); | 2022 Handle<Object> Error = GetProperty(global, "Error"); |
| 2018 if (Error->IsJSObject()) { | 2023 if (Error->IsJSObject()) { |
| 2019 Handle<String> name = | 2024 Handle<String> name = |
| 2020 factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("stackTraceLimit")); | 2025 factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("stackTraceLimit")); |
| 2021 Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit)); | 2026 Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit), |
| 2027 isolate); |
| 2022 CHECK_NOT_EMPTY_HANDLE(isolate, | 2028 CHECK_NOT_EMPTY_HANDLE(isolate, |
| 2023 JSObject::SetLocalPropertyIgnoreAttributes( | 2029 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2024 Handle<JSObject>::cast(Error), name, | 2030 Handle<JSObject>::cast(Error), name, |
| 2025 stack_trace_limit, NONE)); | 2031 stack_trace_limit, NONE)); |
| 2026 } | 2032 } |
| 2027 | 2033 |
| 2028 #ifdef ENABLE_DEBUGGER_SUPPORT | 2034 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 2029 // Expose the debug global object in global if a name for it is specified. | 2035 // Expose the debug global object in global if a name for it is specified. |
| 2030 if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) { | 2036 if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) { |
| 2031 Debug* debug = isolate->debug(); | 2037 Debug* debug = isolate->debug(); |
| 2032 // If loading fails we just bail out without installing the | 2038 // If loading fails we just bail out without installing the |
| 2033 // debugger but without tanking the whole context. | 2039 // debugger but without tanking the whole context. |
| 2034 if (!debug->Load()) return; | 2040 if (!debug->Load()) return; |
| 2035 // Set the security token for the debugger context to the same as | 2041 // Set the security token for the debugger context to the same as |
| 2036 // the shell native context to allow calling between these (otherwise | 2042 // the shell native context to allow calling between these (otherwise |
| 2037 // exposing debug global object doesn't make much sense). | 2043 // exposing debug global object doesn't make much sense). |
| 2038 debug->debug_context()->set_security_token( | 2044 debug->debug_context()->set_security_token( |
| 2039 native_context->security_token()); | 2045 native_context->security_token()); |
| 2040 | 2046 |
| 2041 Handle<String> debug_string = | 2047 Handle<String> debug_string = |
| 2042 factory->LookupUtf8Symbol(FLAG_expose_debug_as); | 2048 factory->LookupUtf8Symbol(FLAG_expose_debug_as); |
| 2043 Handle<Object> global_proxy(debug->debug_context()->global_proxy()); | 2049 Handle<Object> global_proxy(debug->debug_context()->global_proxy(), |
| 2050 isolate); |
| 2044 CHECK_NOT_EMPTY_HANDLE(isolate, | 2051 CHECK_NOT_EMPTY_HANDLE(isolate, |
| 2045 JSObject::SetLocalPropertyIgnoreAttributes( | 2052 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2046 global, debug_string, global_proxy, DONT_ENUM)); | 2053 global, debug_string, global_proxy, DONT_ENUM)); |
| 2047 } | 2054 } |
| 2048 #endif | 2055 #endif |
| 2049 } | 2056 } |
| 2050 | 2057 |
| 2051 static uint32_t Hash(RegisteredExtension* extension) { | 2058 static uint32_t Hash(RegisteredExtension* extension) { |
| 2052 return v8::internal::ComputePointerHash(extension); | 2059 return v8::internal::ComputePointerHash(extension); |
| 2053 } | 2060 } |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2248 if (from->HasFastProperties()) { | 2255 if (from->HasFastProperties()) { |
| 2249 Handle<DescriptorArray> descs = | 2256 Handle<DescriptorArray> descs = |
| 2250 Handle<DescriptorArray>(from->map()->instance_descriptors()); | 2257 Handle<DescriptorArray>(from->map()->instance_descriptors()); |
| 2251 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 2258 for (int i = 0; i < descs->number_of_descriptors(); i++) { |
| 2252 PropertyDetails details = descs->GetDetails(i); | 2259 PropertyDetails details = descs->GetDetails(i); |
| 2253 switch (details.type()) { | 2260 switch (details.type()) { |
| 2254 case FIELD: { | 2261 case FIELD: { |
| 2255 HandleScope inner(isolate()); | 2262 HandleScope inner(isolate()); |
| 2256 Handle<String> key = Handle<String>(descs->GetKey(i)); | 2263 Handle<String> key = Handle<String>(descs->GetKey(i)); |
| 2257 int index = descs->GetFieldIndex(i); | 2264 int index = descs->GetFieldIndex(i); |
| 2258 Handle<Object> value = Handle<Object>(from->FastPropertyAt(index)); | 2265 Handle<Object> value = Handle<Object>(from->FastPropertyAt(index), |
| 2259 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), | 2266 isolate()); |
| 2267 CHECK_NOT_EMPTY_HANDLE(isolate(), |
| 2260 JSObject::SetLocalPropertyIgnoreAttributes( | 2268 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2261 to, key, value, details.attributes())); | 2269 to, key, value, details.attributes())); |
| 2262 break; | 2270 break; |
| 2263 } | 2271 } |
| 2264 case CONSTANT_FUNCTION: { | 2272 case CONSTANT_FUNCTION: { |
| 2265 HandleScope inner(isolate()); | 2273 HandleScope inner(isolate()); |
| 2266 Handle<String> key = Handle<String>(descs->GetKey(i)); | 2274 Handle<String> key = Handle<String>(descs->GetKey(i)); |
| 2267 Handle<JSFunction> fun = | 2275 Handle<JSFunction> fun = |
| 2268 Handle<JSFunction>(descs->GetConstantFunction(i)); | 2276 Handle<JSFunction>(descs->GetConstantFunction(i)); |
| 2269 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), | 2277 CHECK_NOT_EMPTY_HANDLE(isolate(), |
| 2270 JSObject::SetLocalPropertyIgnoreAttributes( | 2278 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2271 to, key, fun, details.attributes())); | 2279 to, key, fun, details.attributes())); |
| 2272 break; | 2280 break; |
| 2273 } | 2281 } |
| 2274 case CALLBACKS: { | 2282 case CALLBACKS: { |
| 2275 LookupResult result(isolate()); | 2283 LookupResult result(isolate()); |
| 2276 to->LocalLookup(descs->GetKey(i), &result); | 2284 to->LocalLookup(descs->GetKey(i), &result); |
| 2277 // If the property is already there we skip it | 2285 // If the property is already there we skip it |
| 2278 if (result.IsFound()) continue; | 2286 if (result.IsFound()) continue; |
| 2279 HandleScope inner(isolate()); | 2287 HandleScope inner(isolate()); |
| 2280 ASSERT(!to->HasFastProperties()); | 2288 ASSERT(!to->HasFastProperties()); |
| 2281 // Add to dictionary. | 2289 // Add to dictionary. |
| 2282 Handle<String> key = Handle<String>(descs->GetKey(i)); | 2290 Handle<String> key = Handle<String>(descs->GetKey(i)); |
| 2283 Handle<Object> callbacks(descs->GetCallbacksObject(i)); | 2291 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); |
| 2284 PropertyDetails d = PropertyDetails(details.attributes(), | 2292 PropertyDetails d = PropertyDetails(details.attributes(), |
| 2285 CALLBACKS, | 2293 CALLBACKS, |
| 2286 details.descriptor_index()); | 2294 details.descriptor_index()); |
| 2287 JSObject::SetNormalizedProperty(to, key, callbacks, d); | 2295 JSObject::SetNormalizedProperty(to, key, callbacks, d); |
| 2288 break; | 2296 break; |
| 2289 } | 2297 } |
| 2290 case NORMAL: | 2298 case NORMAL: |
| 2291 // Do not occur since the from object has fast properties. | 2299 // Do not occur since the from object has fast properties. |
| 2292 case HANDLER: | 2300 case HANDLER: |
| 2293 case INTERCEPTOR: | 2301 case INTERCEPTOR: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2305 for (int i = 0; i < capacity; i++) { | 2313 for (int i = 0; i < capacity; i++) { |
| 2306 Object* raw_key(properties->KeyAt(i)); | 2314 Object* raw_key(properties->KeyAt(i)); |
| 2307 if (properties->IsKey(raw_key)) { | 2315 if (properties->IsKey(raw_key)) { |
| 2308 ASSERT(raw_key->IsString()); | 2316 ASSERT(raw_key->IsString()); |
| 2309 // If the property is already there we skip it. | 2317 // If the property is already there we skip it. |
| 2310 LookupResult result(isolate()); | 2318 LookupResult result(isolate()); |
| 2311 to->LocalLookup(String::cast(raw_key), &result); | 2319 to->LocalLookup(String::cast(raw_key), &result); |
| 2312 if (result.IsFound()) continue; | 2320 if (result.IsFound()) continue; |
| 2313 // Set the property. | 2321 // Set the property. |
| 2314 Handle<String> key = Handle<String>(String::cast(raw_key)); | 2322 Handle<String> key = Handle<String>(String::cast(raw_key)); |
| 2315 Handle<Object> value = Handle<Object>(properties->ValueAt(i)); | 2323 Handle<Object> value = Handle<Object>(properties->ValueAt(i), |
| 2324 isolate()); |
| 2316 if (value->IsJSGlobalPropertyCell()) { | 2325 if (value->IsJSGlobalPropertyCell()) { |
| 2317 value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value()); | 2326 value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value(), |
| 2327 isolate()); |
| 2318 } | 2328 } |
| 2319 PropertyDetails details = properties->DetailsAt(i); | 2329 PropertyDetails details = properties->DetailsAt(i); |
| 2320 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), | 2330 CHECK_NOT_EMPTY_HANDLE(isolate(), |
| 2321 JSObject::SetLocalPropertyIgnoreAttributes( | 2331 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2322 to, key, value, details.attributes())); | 2332 to, key, value, details.attributes())); |
| 2323 } | 2333 } |
| 2324 } | 2334 } |
| 2325 } | 2335 } |
| 2326 } | 2336 } |
| 2327 | 2337 |
| 2328 | 2338 |
| 2329 void Genesis::TransferIndexedProperties(Handle<JSObject> from, | 2339 void Genesis::TransferIndexedProperties(Handle<JSObject> from, |
| 2330 Handle<JSObject> to) { | 2340 Handle<JSObject> to) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2457 return from + sizeof(NestingCounterType); | 2467 return from + sizeof(NestingCounterType); |
| 2458 } | 2468 } |
| 2459 | 2469 |
| 2460 | 2470 |
| 2461 // Called when the top-level V8 mutex is destroyed. | 2471 // Called when the top-level V8 mutex is destroyed. |
| 2462 void Bootstrapper::FreeThreadResources() { | 2472 void Bootstrapper::FreeThreadResources() { |
| 2463 ASSERT(!IsActive()); | 2473 ASSERT(!IsActive()); |
| 2464 } | 2474 } |
| 2465 | 2475 |
| 2466 } } // namespace v8::internal | 2476 } } // namespace v8::internal |
| OLD | NEW |