| 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 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2232 void Genesis::TransferNamedProperties(Handle<JSObject> from, | 2232 void Genesis::TransferNamedProperties(Handle<JSObject> from, |
| 2233 Handle<JSObject> to) { | 2233 Handle<JSObject> to) { |
| 2234 if (from->HasFastProperties()) { | 2234 if (from->HasFastProperties()) { |
| 2235 Handle<DescriptorArray> descs = | 2235 Handle<DescriptorArray> descs = |
| 2236 Handle<DescriptorArray>(from->map()->instance_descriptors()); | 2236 Handle<DescriptorArray>(from->map()->instance_descriptors()); |
| 2237 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 2237 for (int i = 0; i < descs->number_of_descriptors(); i++) { |
| 2238 PropertyDetails details = descs->GetDetails(i); | 2238 PropertyDetails details = descs->GetDetails(i); |
| 2239 switch (details.type()) { | 2239 switch (details.type()) { |
| 2240 case FIELD: { | 2240 case FIELD: { |
| 2241 HandleScope inner; | 2241 HandleScope inner; |
| 2242 Handle<String> key = Handle<String>(descs->GetKey(i)); | 2242 Handle<Name> key = Handle<Name>(descs->GetKey(i)); |
| 2243 int index = descs->GetFieldIndex(i); | 2243 int index = descs->GetFieldIndex(i); |
| 2244 Handle<Object> value = Handle<Object>(from->FastPropertyAt(index)); | 2244 Handle<Object> value = Handle<Object>(from->FastPropertyAt(index)); |
| 2245 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), | 2245 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), |
| 2246 JSObject::SetLocalPropertyIgnoreAttributes( | 2246 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2247 to, key, value, details.attributes())); | 2247 to, key, value, details.attributes())); |
| 2248 break; | 2248 break; |
| 2249 } | 2249 } |
| 2250 case CONSTANT_FUNCTION: { | 2250 case CONSTANT_FUNCTION: { |
| 2251 HandleScope inner; | 2251 HandleScope inner; |
| 2252 Handle<String> key = Handle<String>(descs->GetKey(i)); | 2252 Handle<Name> key = Handle<Name>(descs->GetKey(i)); |
| 2253 Handle<JSFunction> fun = | 2253 Handle<JSFunction> fun = |
| 2254 Handle<JSFunction>(descs->GetConstantFunction(i)); | 2254 Handle<JSFunction>(descs->GetConstantFunction(i)); |
| 2255 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), | 2255 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), |
| 2256 JSObject::SetLocalPropertyIgnoreAttributes( | 2256 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2257 to, key, fun, details.attributes())); | 2257 to, key, fun, details.attributes())); |
| 2258 break; | 2258 break; |
| 2259 } | 2259 } |
| 2260 case CALLBACKS: { | 2260 case CALLBACKS: { |
| 2261 LookupResult result(isolate()); | 2261 LookupResult result(isolate()); |
| 2262 to->LocalLookup(descs->GetKey(i), &result); | 2262 to->LocalLookup(descs->GetKey(i), &result); |
| 2263 // If the property is already there we skip it | 2263 // If the property is already there we skip it |
| 2264 if (result.IsFound()) continue; | 2264 if (result.IsFound()) continue; |
| 2265 HandleScope inner; | 2265 HandleScope inner; |
| 2266 ASSERT(!to->HasFastProperties()); | 2266 ASSERT(!to->HasFastProperties()); |
| 2267 // Add to dictionary. | 2267 // Add to dictionary. |
| 2268 Handle<String> key = Handle<String>(descs->GetKey(i)); | 2268 Handle<Name> key = Handle<Name>(descs->GetKey(i)); |
| 2269 Handle<Object> callbacks(descs->GetCallbacksObject(i)); | 2269 Handle<Object> callbacks(descs->GetCallbacksObject(i)); |
| 2270 PropertyDetails d = PropertyDetails(details.attributes(), | 2270 PropertyDetails d = PropertyDetails(details.attributes(), |
| 2271 CALLBACKS, | 2271 CALLBACKS, |
| 2272 details.descriptor_index()); | 2272 details.descriptor_index()); |
| 2273 JSObject::SetNormalizedProperty(to, key, callbacks, d); | 2273 JSObject::SetNormalizedProperty(to, key, callbacks, d); |
| 2274 break; | 2274 break; |
| 2275 } | 2275 } |
| 2276 case NORMAL: | 2276 case NORMAL: |
| 2277 // Do not occur since the from object has fast properties. | 2277 // Do not occur since the from object has fast properties. |
| 2278 case HANDLER: | 2278 case HANDLER: |
| 2279 case INTERCEPTOR: | 2279 case INTERCEPTOR: |
| 2280 case TRANSITION: | 2280 case TRANSITION: |
| 2281 case NONEXISTENT: | 2281 case NONEXISTENT: |
| 2282 // No element in instance descriptors have proxy or interceptor type. | 2282 // No element in instance descriptors have proxy or interceptor type. |
| 2283 UNREACHABLE(); | 2283 UNREACHABLE(); |
| 2284 break; | 2284 break; |
| 2285 } | 2285 } |
| 2286 } | 2286 } |
| 2287 } else { | 2287 } else { |
| 2288 Handle<StringDictionary> properties = | 2288 Handle<NameDictionary> properties = |
| 2289 Handle<StringDictionary>(from->property_dictionary()); | 2289 Handle<NameDictionary>(from->property_dictionary()); |
| 2290 int capacity = properties->Capacity(); | 2290 int capacity = properties->Capacity(); |
| 2291 for (int i = 0; i < capacity; i++) { | 2291 for (int i = 0; i < capacity; i++) { |
| 2292 Object* raw_key(properties->KeyAt(i)); | 2292 Object* raw_key(properties->KeyAt(i)); |
| 2293 if (properties->IsKey(raw_key)) { | 2293 if (properties->IsKey(raw_key)) { |
| 2294 ASSERT(raw_key->IsString()); | 2294 ASSERT(raw_key->IsName()); |
| 2295 // If the property is already there we skip it. | 2295 // If the property is already there we skip it. |
| 2296 LookupResult result(isolate()); | 2296 LookupResult result(isolate()); |
| 2297 to->LocalLookup(String::cast(raw_key), &result); | 2297 to->LocalLookup(Name::cast(raw_key), &result); |
| 2298 if (result.IsFound()) continue; | 2298 if (result.IsFound()) continue; |
| 2299 // Set the property. | 2299 // Set the property. |
| 2300 Handle<String> key = Handle<String>(String::cast(raw_key)); | 2300 Handle<Name> key = Handle<Name>(Name::cast(raw_key)); |
| 2301 Handle<Object> value = Handle<Object>(properties->ValueAt(i)); | 2301 Handle<Object> value = Handle<Object>(properties->ValueAt(i)); |
| 2302 if (value->IsJSGlobalPropertyCell()) { | 2302 if (value->IsJSGlobalPropertyCell()) { |
| 2303 value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value()); | 2303 value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value()); |
| 2304 } | 2304 } |
| 2305 PropertyDetails details = properties->DetailsAt(i); | 2305 PropertyDetails details = properties->DetailsAt(i); |
| 2306 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), | 2306 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), |
| 2307 JSObject::SetLocalPropertyIgnoreAttributes( | 2307 JSObject::SetLocalPropertyIgnoreAttributes( |
| 2308 to, key, value, details.attributes())); | 2308 to, key, value, details.attributes())); |
| 2309 } | 2309 } |
| 2310 } | 2310 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2441 return from + sizeof(NestingCounterType); | 2441 return from + sizeof(NestingCounterType); |
| 2442 } | 2442 } |
| 2443 | 2443 |
| 2444 | 2444 |
| 2445 // Called when the top-level V8 mutex is destroyed. | 2445 // Called when the top-level V8 mutex is destroyed. |
| 2446 void Bootstrapper::FreeThreadResources() { | 2446 void Bootstrapper::FreeThreadResources() { |
| 2447 ASSERT(!IsActive()); | 2447 ASSERT(!IsActive()); |
| 2448 } | 2448 } |
| 2449 | 2449 |
| 2450 } } // namespace v8::internal | 2450 } } // namespace v8::internal |
| OLD | NEW |