OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 // if args[1] is a data property on args[0] | 954 // if args[1] is a data property on args[0] |
955 // [false, value, Writeable, Enumerable, Configurable] | 955 // [false, value, Writeable, Enumerable, Configurable] |
956 // if args[1] is an accessor on args[0] | 956 // if args[1] is an accessor on args[0] |
957 // [true, GetFunction, SetFunction, Enumerable, Configurable] | 957 // [true, GetFunction, SetFunction, Enumerable, Configurable] |
958 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOwnProperty) { | 958 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOwnProperty) { |
959 ASSERT(args.length() == 2); | 959 ASSERT(args.length() == 2); |
960 Heap* heap = isolate->heap(); | 960 Heap* heap = isolate->heap(); |
961 HandleScope scope(isolate); | 961 HandleScope scope(isolate); |
962 Handle<FixedArray> elms = isolate->factory()->NewFixedArray(DESCRIPTOR_SIZE); | 962 Handle<FixedArray> elms = isolate->factory()->NewFixedArray(DESCRIPTOR_SIZE); |
963 Handle<JSArray> desc = isolate->factory()->NewJSArrayWithElements(elms); | 963 Handle<JSArray> desc = isolate->factory()->NewJSArrayWithElements(elms); |
964 LookupResult result; | 964 LookupResult result(isolate); |
965 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 965 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
966 CONVERT_ARG_CHECKED(String, name, 1); | 966 CONVERT_ARG_CHECKED(String, name, 1); |
967 | 967 |
968 // This could be an element. | 968 // This could be an element. |
969 uint32_t index; | 969 uint32_t index; |
970 if (name->AsArrayIndex(&index)) { | 970 if (name->AsArrayIndex(&index)) { |
971 switch (obj->HasLocalElement(index)) { | 971 switch (obj->HasLocalElement(index)) { |
972 case JSObject::UNDEFINED_ELEMENT: | 972 case JSObject::UNDEFINED_ELEMENT: |
973 return heap->undefined_value(); | 973 return heap->undefined_value(); |
974 | 974 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 Handle<Object> value(pairs->get(i + 1), isolate); | 1233 Handle<Object> value(pairs->get(i + 1), isolate); |
1234 | 1234 |
1235 // We have to declare a global const property. To capture we only | 1235 // We have to declare a global const property. To capture we only |
1236 // assign to it when evaluating the assignment for "const x = | 1236 // assign to it when evaluating the assignment for "const x = |
1237 // <expr>" the initial value is the hole. | 1237 // <expr>" the initial value is the hole. |
1238 bool is_const_property = value->IsTheHole(); | 1238 bool is_const_property = value->IsTheHole(); |
1239 bool is_function_declaration = false; | 1239 bool is_function_declaration = false; |
1240 if (value->IsUndefined() || is_const_property) { | 1240 if (value->IsUndefined() || is_const_property) { |
1241 // Lookup the property in the global object, and don't set the | 1241 // Lookup the property in the global object, and don't set the |
1242 // value of the variable if the property is already there. | 1242 // value of the variable if the property is already there. |
1243 LookupResult lookup; | 1243 LookupResult lookup(isolate); |
1244 global->Lookup(*name, &lookup); | 1244 global->Lookup(*name, &lookup); |
1245 if (lookup.IsProperty()) { | 1245 if (lookup.IsProperty()) { |
1246 // We found an existing property. Unless it was an interceptor | 1246 // We found an existing property. Unless it was an interceptor |
1247 // that claims the property is absent, skip this declaration. | 1247 // that claims the property is absent, skip this declaration. |
1248 if (lookup.type() != INTERCEPTOR) { | 1248 if (lookup.type() != INTERCEPTOR) { |
1249 continue; | 1249 continue; |
1250 } | 1250 } |
1251 PropertyAttributes attributes = global->GetPropertyAttribute(*name); | 1251 PropertyAttributes attributes = global->GetPropertyAttribute(*name); |
1252 if (attributes != ABSENT) { | 1252 if (attributes != ABSENT) { |
1253 continue; | 1253 continue; |
1254 } | 1254 } |
1255 // Fall-through and introduce the absent property by using | 1255 // Fall-through and introduce the absent property by using |
1256 // SetProperty. | 1256 // SetProperty. |
1257 } | 1257 } |
1258 } else { | 1258 } else { |
1259 is_function_declaration = true; | 1259 is_function_declaration = true; |
1260 // Copy the function and update its context. Use it as value. | 1260 // Copy the function and update its context. Use it as value. |
1261 Handle<SharedFunctionInfo> shared = | 1261 Handle<SharedFunctionInfo> shared = |
1262 Handle<SharedFunctionInfo>::cast(value); | 1262 Handle<SharedFunctionInfo>::cast(value); |
1263 Handle<JSFunction> function = | 1263 Handle<JSFunction> function = |
1264 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, | 1264 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, |
1265 context, | 1265 context, |
1266 TENURED); | 1266 TENURED); |
1267 value = function; | 1267 value = function; |
1268 } | 1268 } |
1269 | 1269 |
1270 LookupResult lookup; | 1270 LookupResult lookup(isolate); |
1271 global->LocalLookup(*name, &lookup); | 1271 global->LocalLookup(*name, &lookup); |
1272 | 1272 |
1273 // Compute the property attributes. According to ECMA-262, section | 1273 // Compute the property attributes. According to ECMA-262, section |
1274 // 13, page 71, the property must be read-only and | 1274 // 13, page 71, the property must be read-only and |
1275 // non-deletable. However, neither SpiderMonkey nor KJS creates the | 1275 // non-deletable. However, neither SpiderMonkey nor KJS creates the |
1276 // property as read-only, so we don't either. | 1276 // property as read-only, so we don't either. |
1277 int attr = NONE; | 1277 int attr = NONE; |
1278 if ((flags & kDeclareGlobalsEvalFlag) == 0) { | 1278 if ((flags & kDeclareGlobalsEvalFlag) == 0) { |
1279 attr |= DONT_DELETE; | 1279 attr |= DONT_DELETE; |
1280 } | 1280 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 Handle<Object> value(isolate->heap()->undefined_value(), isolate); | 1392 Handle<Object> value(isolate->heap()->undefined_value(), isolate); |
1393 if (*initial_value != NULL) value = initial_value; | 1393 if (*initial_value != NULL) value = initial_value; |
1394 // Declaring a const context slot is a conflicting declaration if | 1394 // Declaring a const context slot is a conflicting declaration if |
1395 // there is a callback with that name in a prototype. It is | 1395 // there is a callback with that name in a prototype. It is |
1396 // allowed to introduce const variables in | 1396 // allowed to introduce const variables in |
1397 // JSContextExtensionObjects. They are treated specially in | 1397 // JSContextExtensionObjects. They are treated specially in |
1398 // SetProperty and no setters are invoked for those since they are | 1398 // SetProperty and no setters are invoked for those since they are |
1399 // not real JSObjects. | 1399 // not real JSObjects. |
1400 if (initial_value->IsTheHole() && | 1400 if (initial_value->IsTheHole() && |
1401 !object->IsJSContextExtensionObject()) { | 1401 !object->IsJSContextExtensionObject()) { |
1402 LookupResult lookup; | 1402 LookupResult lookup(isolate); |
1403 object->Lookup(*name, &lookup); | 1403 object->Lookup(*name, &lookup); |
1404 if (lookup.IsProperty() && (lookup.type() == CALLBACKS)) { | 1404 if (lookup.IsProperty() && (lookup.type() == CALLBACKS)) { |
1405 return ThrowRedeclarationError(isolate, "const", name); | 1405 return ThrowRedeclarationError(isolate, "const", name); |
1406 } | 1406 } |
1407 } | 1407 } |
1408 RETURN_IF_EMPTY_HANDLE(isolate, | 1408 RETURN_IF_EMPTY_HANDLE(isolate, |
1409 SetProperty(object, name, value, mode, | 1409 SetProperty(object, name, value, mode, |
1410 kNonStrictMode)); | 1410 kNonStrictMode)); |
1411 } | 1411 } |
1412 | 1412 |
(...skipping 23 matching lines...) Expand all Loading... |
1436 PropertyAttributes attributes = DONT_DELETE; | 1436 PropertyAttributes attributes = DONT_DELETE; |
1437 | 1437 |
1438 // Lookup the property locally in the global object. If it isn't | 1438 // Lookup the property locally in the global object. If it isn't |
1439 // there, there is a property with this name in the prototype chain. | 1439 // there, there is a property with this name in the prototype chain. |
1440 // We follow Safari and Firefox behavior and only set the property | 1440 // We follow Safari and Firefox behavior and only set the property |
1441 // locally if there is an explicit initialization value that we have | 1441 // locally if there is an explicit initialization value that we have |
1442 // to assign to the property. | 1442 // to assign to the property. |
1443 // Note that objects can have hidden prototypes, so we need to traverse | 1443 // Note that objects can have hidden prototypes, so we need to traverse |
1444 // the whole chain of hidden prototypes to do a 'local' lookup. | 1444 // the whole chain of hidden prototypes to do a 'local' lookup. |
1445 Object* object = global; | 1445 Object* object = global; |
1446 LookupResult lookup; | 1446 LookupResult lookup(isolate); |
1447 while (object->IsJSObject() && | 1447 while (object->IsJSObject() && |
1448 JSObject::cast(object)->map()->is_hidden_prototype()) { | 1448 JSObject::cast(object)->map()->is_hidden_prototype()) { |
1449 JSObject* raw_holder = JSObject::cast(object); | 1449 JSObject* raw_holder = JSObject::cast(object); |
1450 raw_holder->LocalLookup(*name, &lookup); | 1450 raw_holder->LocalLookup(*name, &lookup); |
1451 if (lookup.IsProperty() && lookup.type() == INTERCEPTOR) { | 1451 if (lookup.IsProperty() && lookup.type() == INTERCEPTOR) { |
1452 HandleScope handle_scope(isolate); | 1452 HandleScope handle_scope(isolate); |
1453 Handle<JSObject> holder(raw_holder); | 1453 Handle<JSObject> holder(raw_holder); |
1454 PropertyAttributes intercepted = holder->GetPropertyAttribute(*name); | 1454 PropertyAttributes intercepted = holder->GetPropertyAttribute(*name); |
1455 // Update the raw pointer in case it's changed due to GC. | 1455 // Update the raw pointer in case it's changed due to GC. |
1456 raw_holder = *holder; | 1456 raw_holder = *holder; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 // According to ECMA-262, section 12.2, page 62, the property must | 1490 // According to ECMA-262, section 12.2, page 62, the property must |
1491 // not be deletable. Since it's a const, it must be READ_ONLY too. | 1491 // not be deletable. Since it's a const, it must be READ_ONLY too. |
1492 PropertyAttributes attributes = | 1492 PropertyAttributes attributes = |
1493 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); | 1493 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); |
1494 | 1494 |
1495 // Lookup the property locally in the global object. If it isn't | 1495 // Lookup the property locally in the global object. If it isn't |
1496 // there, we add the property and take special precautions to always | 1496 // there, we add the property and take special precautions to always |
1497 // add it as a local property even in case of callbacks in the | 1497 // add it as a local property even in case of callbacks in the |
1498 // prototype chain (this rules out using SetProperty). | 1498 // prototype chain (this rules out using SetProperty). |
1499 // We use SetLocalPropertyIgnoreAttributes instead | 1499 // We use SetLocalPropertyIgnoreAttributes instead |
1500 LookupResult lookup; | 1500 LookupResult lookup(isolate); |
1501 global->LocalLookup(*name, &lookup); | 1501 global->LocalLookup(*name, &lookup); |
1502 if (!lookup.IsProperty()) { | 1502 if (!lookup.IsProperty()) { |
1503 return global->SetLocalPropertyIgnoreAttributes(*name, | 1503 return global->SetLocalPropertyIgnoreAttributes(*name, |
1504 *value, | 1504 *value, |
1505 attributes); | 1505 attributes); |
1506 } | 1506 } |
1507 | 1507 |
1508 if (!lookup.IsReadOnly()) { | 1508 if (!lookup.IsReadOnly()) { |
1509 // Restore global object from context (in case of GC) and continue | 1509 // Restore global object from context (in case of GC) and continue |
1510 // with setting the value. | 1510 // with setting the value. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 // | 1607 // |
1608 // function f() { eval("delete x; const x;"); } | 1608 // function f() { eval("delete x; const x;"); } |
1609 // | 1609 // |
1610 // In that case, the initialization behaves like a normal assignment. | 1610 // In that case, the initialization behaves like a normal assignment. |
1611 Handle<JSObject> object = Handle<JSObject>::cast(holder); | 1611 Handle<JSObject> object = Handle<JSObject>::cast(holder); |
1612 | 1612 |
1613 if (*object == context->extension()) { | 1613 if (*object == context->extension()) { |
1614 // This is the property that was introduced by the const declaration. | 1614 // This is the property that was introduced by the const declaration. |
1615 // Set it if it hasn't been set before. NOTE: We cannot use | 1615 // Set it if it hasn't been set before. NOTE: We cannot use |
1616 // GetProperty() to get the current value as it 'unholes' the value. | 1616 // GetProperty() to get the current value as it 'unholes' the value. |
1617 LookupResult lookup; | 1617 LookupResult lookup(isolate); |
1618 object->LocalLookupRealNamedProperty(*name, &lookup); | 1618 object->LocalLookupRealNamedProperty(*name, &lookup); |
1619 ASSERT(lookup.IsProperty()); // the property was declared | 1619 ASSERT(lookup.IsProperty()); // the property was declared |
1620 ASSERT(lookup.IsReadOnly()); // and it was declared as read-only | 1620 ASSERT(lookup.IsReadOnly()); // and it was declared as read-only |
1621 | 1621 |
1622 PropertyType type = lookup.type(); | 1622 PropertyType type = lookup.type(); |
1623 if (type == FIELD) { | 1623 if (type == FIELD) { |
1624 FixedArray* properties = object->properties(); | 1624 FixedArray* properties = object->properties(); |
1625 int index = lookup.GetFieldIndex(); | 1625 int index = lookup.GetFieldIndex(); |
1626 if (properties->get(index)->IsTheHole()) { | 1626 if (properties->get(index)->IsTheHole()) { |
1627 properties->set(index, *value); | 1627 properties->set(index, *value); |
(...skipping 2500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4128 if (receiver->HasFastProperties()) { | 4128 if (receiver->HasFastProperties()) { |
4129 // Attempt to use lookup cache. | 4129 // Attempt to use lookup cache. |
4130 Map* receiver_map = receiver->map(); | 4130 Map* receiver_map = receiver->map(); |
4131 KeyedLookupCache* keyed_lookup_cache = isolate->keyed_lookup_cache(); | 4131 KeyedLookupCache* keyed_lookup_cache = isolate->keyed_lookup_cache(); |
4132 int offset = keyed_lookup_cache->Lookup(receiver_map, key); | 4132 int offset = keyed_lookup_cache->Lookup(receiver_map, key); |
4133 if (offset != -1) { | 4133 if (offset != -1) { |
4134 Object* value = receiver->FastPropertyAt(offset); | 4134 Object* value = receiver->FastPropertyAt(offset); |
4135 return value->IsTheHole() ? isolate->heap()->undefined_value() : value; | 4135 return value->IsTheHole() ? isolate->heap()->undefined_value() : value; |
4136 } | 4136 } |
4137 // Lookup cache miss. Perform lookup and update the cache if appropriate. | 4137 // Lookup cache miss. Perform lookup and update the cache if appropriate. |
4138 LookupResult result; | 4138 LookupResult result(isolate); |
4139 receiver->LocalLookup(key, &result); | 4139 receiver->LocalLookup(key, &result); |
4140 if (result.IsProperty() && result.type() == FIELD) { | 4140 if (result.IsProperty() && result.type() == FIELD) { |
4141 int offset = result.GetFieldIndex(); | 4141 int offset = result.GetFieldIndex(); |
4142 keyed_lookup_cache->Update(receiver_map, key, offset); | 4142 keyed_lookup_cache->Update(receiver_map, key, offset); |
4143 return receiver->FastPropertyAt(offset); | 4143 return receiver->FastPropertyAt(offset); |
4144 } | 4144 } |
4145 } else { | 4145 } else { |
4146 // Attempt dictionary lookup. | 4146 // Attempt dictionary lookup. |
4147 StringDictionary* dictionary = receiver->property_dictionary(); | 4147 StringDictionary* dictionary = receiver->property_dictionary(); |
4148 int entry = dictionary->FindEntry(key); | 4148 int entry = dictionary->FindEntry(key); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4183 HandleScope scope(isolate); | 4183 HandleScope scope(isolate); |
4184 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 4184 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
4185 CONVERT_CHECKED(String, name, args[1]); | 4185 CONVERT_CHECKED(String, name, args[1]); |
4186 CONVERT_CHECKED(Smi, flag_setter, args[2]); | 4186 CONVERT_CHECKED(Smi, flag_setter, args[2]); |
4187 Object* fun = args[3]; | 4187 Object* fun = args[3]; |
4188 RUNTIME_ASSERT(fun->IsSpecFunction() || fun->IsUndefined()); | 4188 RUNTIME_ASSERT(fun->IsSpecFunction() || fun->IsUndefined()); |
4189 CONVERT_CHECKED(Smi, flag_attr, args[4]); | 4189 CONVERT_CHECKED(Smi, flag_attr, args[4]); |
4190 int unchecked = flag_attr->value(); | 4190 int unchecked = flag_attr->value(); |
4191 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 4191 RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); |
4192 RUNTIME_ASSERT(!obj->IsNull()); | 4192 RUNTIME_ASSERT(!obj->IsNull()); |
4193 LookupResult result; | 4193 LookupResult result(isolate); |
4194 obj->LocalLookupRealNamedProperty(name, &result); | 4194 obj->LocalLookupRealNamedProperty(name, &result); |
4195 | 4195 |
4196 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); | 4196 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); |
4197 // If an existing property is either FIELD, NORMAL or CONSTANT_FUNCTION | 4197 // If an existing property is either FIELD, NORMAL or CONSTANT_FUNCTION |
4198 // delete it to avoid running into trouble in DefineAccessor, which | 4198 // delete it to avoid running into trouble in DefineAccessor, which |
4199 // handles this incorrectly if the property is readonly (does nothing) | 4199 // handles this incorrectly if the property is readonly (does nothing) |
4200 if (result.IsProperty() && | 4200 if (result.IsProperty() && |
4201 (result.type() == FIELD || result.type() == NORMAL | 4201 (result.type() == FIELD || result.type() == NORMAL |
4202 || result.type() == CONSTANT_FUNCTION)) { | 4202 || result.type() == CONSTANT_FUNCTION)) { |
4203 Object* ok; | 4203 Object* ok; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4267 if (*extended_dictionary != *dictionary) { | 4267 if (*extended_dictionary != *dictionary) { |
4268 if (js_object->GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { | 4268 if (js_object->GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { |
4269 FixedArray::cast(js_object->elements())->set(1, *extended_dictionary); | 4269 FixedArray::cast(js_object->elements())->set(1, *extended_dictionary); |
4270 } else { | 4270 } else { |
4271 js_object->set_elements(*extended_dictionary); | 4271 js_object->set_elements(*extended_dictionary); |
4272 } | 4272 } |
4273 } | 4273 } |
4274 return *obj_value; | 4274 return *obj_value; |
4275 } | 4275 } |
4276 | 4276 |
4277 LookupResult result; | 4277 LookupResult result(isolate); |
4278 js_object->LocalLookupRealNamedProperty(*name, &result); | 4278 js_object->LocalLookupRealNamedProperty(*name, &result); |
4279 | 4279 |
4280 // To be compatible with safari we do not change the value on API objects | 4280 // To be compatible with safari we do not change the value on API objects |
4281 // in defineProperty. Firefox disagrees here, and actually changes the value. | 4281 // in defineProperty. Firefox disagrees here, and actually changes the value. |
4282 if (result.IsProperty() && | 4282 if (result.IsProperty() && |
4283 (result.type() == CALLBACKS) && | 4283 (result.type() == CALLBACKS) && |
4284 result.GetCallbackObject()->IsAccessorInfo()) { | 4284 result.GetCallbackObject()->IsAccessorInfo()) { |
4285 return isolate->heap()->undefined_value(); | 4285 return isolate->heap()->undefined_value(); |
4286 } | 4286 } |
4287 | 4287 |
(...skipping 6066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10354 details->set(1, PropertyDetails(NONE, NORMAL).AsSmi()); | 10354 details->set(1, PropertyDetails(NONE, NORMAL).AsSmi()); |
10355 return *isolate->factory()->NewJSArrayWithElements(details); | 10355 return *isolate->factory()->NewJSArrayWithElements(details); |
10356 } | 10356 } |
10357 | 10357 |
10358 // Find the number of objects making up this. | 10358 // Find the number of objects making up this. |
10359 int length = LocalPrototypeChainLength(*obj); | 10359 int length = LocalPrototypeChainLength(*obj); |
10360 | 10360 |
10361 // Try local lookup on each of the objects. | 10361 // Try local lookup on each of the objects. |
10362 Handle<JSObject> jsproto = obj; | 10362 Handle<JSObject> jsproto = obj; |
10363 for (int i = 0; i < length; i++) { | 10363 for (int i = 0; i < length; i++) { |
10364 LookupResult result; | 10364 LookupResult result(isolate); |
10365 jsproto->LocalLookup(*name, &result); | 10365 jsproto->LocalLookup(*name, &result); |
10366 if (result.IsProperty()) { | 10366 if (result.IsProperty()) { |
10367 // LookupResult is not GC safe as it holds raw object pointers. | 10367 // LookupResult is not GC safe as it holds raw object pointers. |
10368 // GC can happen later in this code so put the required fields into | 10368 // GC can happen later in this code so put the required fields into |
10369 // local variables using handles when required for later use. | 10369 // local variables using handles when required for later use. |
10370 PropertyType result_type = result.type(); | 10370 PropertyType result_type = result.type(); |
10371 Handle<Object> result_callback_obj; | 10371 Handle<Object> result_callback_obj; |
10372 if (result_type == CALLBACKS) { | 10372 if (result_type == CALLBACKS) { |
10373 result_callback_obj = Handle<Object>(result.GetCallbackObject(), | 10373 result_callback_obj = Handle<Object>(result.GetCallbackObject(), |
10374 isolate); | 10374 isolate); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10411 | 10411 |
10412 | 10412 |
10413 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetProperty) { | 10413 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetProperty) { |
10414 HandleScope scope(isolate); | 10414 HandleScope scope(isolate); |
10415 | 10415 |
10416 ASSERT(args.length() == 2); | 10416 ASSERT(args.length() == 2); |
10417 | 10417 |
10418 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 10418 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
10419 CONVERT_ARG_CHECKED(String, name, 1); | 10419 CONVERT_ARG_CHECKED(String, name, 1); |
10420 | 10420 |
10421 LookupResult result; | 10421 LookupResult result(isolate); |
10422 obj->Lookup(*name, &result); | 10422 obj->Lookup(*name, &result); |
10423 if (result.IsProperty()) { | 10423 if (result.IsProperty()) { |
10424 return DebugLookupResultValue(isolate->heap(), *obj, *name, &result, NULL); | 10424 return DebugLookupResultValue(isolate->heap(), *obj, *name, &result, NULL); |
10425 } | 10425 } |
10426 return isolate->heap()->undefined_value(); | 10426 return isolate->heap()->undefined_value(); |
10427 } | 10427 } |
10428 | 10428 |
10429 | 10429 |
10430 // Return the property type calculated from the property details. | 10430 // Return the property type calculated from the property details. |
10431 // args[0]: smi with property details. | 10431 // args[0]: smi with property details. |
(...skipping 2979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13411 } else { | 13411 } else { |
13412 // Handle last resort GC and make sure to allow future allocations | 13412 // Handle last resort GC and make sure to allow future allocations |
13413 // to grow the heap without causing GCs (if possible). | 13413 // to grow the heap without causing GCs (if possible). |
13414 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13414 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13415 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13415 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13416 } | 13416 } |
13417 } | 13417 } |
13418 | 13418 |
13419 | 13419 |
13420 } } // namespace v8::internal | 13420 } } // namespace v8::internal |
OLD | NEW |