| 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 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 // Note: length must be added as the first property and | 1058 // Note: length must be added as the first property and |
| 1059 // callee must be added as the second property. | 1059 // callee must be added as the second property. |
| 1060 SetLocalPropertyNoThrow(result, factory->length_symbol(), | 1060 SetLocalPropertyNoThrow(result, factory->length_symbol(), |
| 1061 factory->undefined_value(), | 1061 factory->undefined_value(), |
| 1062 DONT_ENUM); | 1062 DONT_ENUM); |
| 1063 SetLocalPropertyNoThrow(result, factory->callee_symbol(), | 1063 SetLocalPropertyNoThrow(result, factory->callee_symbol(), |
| 1064 factory->undefined_value(), | 1064 factory->undefined_value(), |
| 1065 DONT_ENUM); | 1065 DONT_ENUM); |
| 1066 | 1066 |
| 1067 #ifdef DEBUG | 1067 #ifdef DEBUG |
| 1068 LookupResult lookup; | 1068 LookupResult lookup(isolate); |
| 1069 result->LocalLookup(heap->callee_symbol(), &lookup); | 1069 result->LocalLookup(heap->callee_symbol(), &lookup); |
| 1070 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); | 1070 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); |
| 1071 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsCalleeIndex); | 1071 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsCalleeIndex); |
| 1072 | 1072 |
| 1073 result->LocalLookup(heap->length_symbol(), &lookup); | 1073 result->LocalLookup(heap->length_symbol(), &lookup); |
| 1074 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); | 1074 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); |
| 1075 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex); | 1075 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex); |
| 1076 | 1076 |
| 1077 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsCalleeIndex); | 1077 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsCalleeIndex); |
| 1078 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex); | 1078 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 // Allocate the arguments boilerplate object. | 1155 // Allocate the arguments boilerplate object. |
| 1156 Handle<JSObject> result = factory->NewJSObjectFromMap(map); | 1156 Handle<JSObject> result = factory->NewJSObjectFromMap(map); |
| 1157 global_context()->set_strict_mode_arguments_boilerplate(*result); | 1157 global_context()->set_strict_mode_arguments_boilerplate(*result); |
| 1158 | 1158 |
| 1159 // Add length property only for strict mode boilerplate. | 1159 // Add length property only for strict mode boilerplate. |
| 1160 SetLocalPropertyNoThrow(result, factory->length_symbol(), | 1160 SetLocalPropertyNoThrow(result, factory->length_symbol(), |
| 1161 factory->undefined_value(), | 1161 factory->undefined_value(), |
| 1162 DONT_ENUM); | 1162 DONT_ENUM); |
| 1163 | 1163 |
| 1164 #ifdef DEBUG | 1164 #ifdef DEBUG |
| 1165 LookupResult lookup; | 1165 LookupResult lookup(isolate); |
| 1166 result->LocalLookup(heap->length_symbol(), &lookup); | 1166 result->LocalLookup(heap->length_symbol(), &lookup); |
| 1167 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); | 1167 ASSERT(lookup.IsProperty() && (lookup.type() == FIELD)); |
| 1168 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex); | 1168 ASSERT(lookup.GetFieldIndex() == Heap::kArgumentsLengthIndex); |
| 1169 | 1169 |
| 1170 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex); | 1170 ASSERT(result->map()->inobject_properties() > Heap::kArgumentsLengthIndex); |
| 1171 | 1171 |
| 1172 // Check the state of the object. | 1172 // Check the state of the object. |
| 1173 ASSERT(result->HasFastProperties()); | 1173 ASSERT(result->HasFastProperties()); |
| 1174 ASSERT(result->HasFastElements()); | 1174 ASSERT(result->HasFastElements()); |
| 1175 #endif | 1175 #endif |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 } | 2081 } |
| 2082 case CONSTANT_FUNCTION: { | 2082 case CONSTANT_FUNCTION: { |
| 2083 HandleScope inner; | 2083 HandleScope inner; |
| 2084 Handle<String> key = Handle<String>(descs->GetKey(i)); | 2084 Handle<String> key = Handle<String>(descs->GetKey(i)); |
| 2085 Handle<JSFunction> fun = | 2085 Handle<JSFunction> fun = |
| 2086 Handle<JSFunction>(descs->GetConstantFunction(i)); | 2086 Handle<JSFunction>(descs->GetConstantFunction(i)); |
| 2087 SetLocalPropertyNoThrow(to, key, fun, details.attributes()); | 2087 SetLocalPropertyNoThrow(to, key, fun, details.attributes()); |
| 2088 break; | 2088 break; |
| 2089 } | 2089 } |
| 2090 case CALLBACKS: { | 2090 case CALLBACKS: { |
| 2091 LookupResult result; | 2091 LookupResult result(isolate()); |
| 2092 to->LocalLookup(descs->GetKey(i), &result); | 2092 to->LocalLookup(descs->GetKey(i), &result); |
| 2093 // If the property is already there we skip it | 2093 // If the property is already there we skip it |
| 2094 if (result.IsProperty()) continue; | 2094 if (result.IsProperty()) continue; |
| 2095 HandleScope inner; | 2095 HandleScope inner; |
| 2096 ASSERT(!to->HasFastProperties()); | 2096 ASSERT(!to->HasFastProperties()); |
| 2097 // Add to dictionary. | 2097 // Add to dictionary. |
| 2098 Handle<String> key = Handle<String>(descs->GetKey(i)); | 2098 Handle<String> key = Handle<String>(descs->GetKey(i)); |
| 2099 Handle<Object> callbacks(descs->GetCallbacksObject(i)); | 2099 Handle<Object> callbacks(descs->GetCallbacksObject(i)); |
| 2100 PropertyDetails d = | 2100 PropertyDetails d = |
| 2101 PropertyDetails(details.attributes(), CALLBACKS, details.index()); | 2101 PropertyDetails(details.attributes(), CALLBACKS, details.index()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2119 } | 2119 } |
| 2120 } else { | 2120 } else { |
| 2121 Handle<StringDictionary> properties = | 2121 Handle<StringDictionary> properties = |
| 2122 Handle<StringDictionary>(from->property_dictionary()); | 2122 Handle<StringDictionary>(from->property_dictionary()); |
| 2123 int capacity = properties->Capacity(); | 2123 int capacity = properties->Capacity(); |
| 2124 for (int i = 0; i < capacity; i++) { | 2124 for (int i = 0; i < capacity; i++) { |
| 2125 Object* raw_key(properties->KeyAt(i)); | 2125 Object* raw_key(properties->KeyAt(i)); |
| 2126 if (properties->IsKey(raw_key)) { | 2126 if (properties->IsKey(raw_key)) { |
| 2127 ASSERT(raw_key->IsString()); | 2127 ASSERT(raw_key->IsString()); |
| 2128 // If the property is already there we skip it. | 2128 // If the property is already there we skip it. |
| 2129 LookupResult result; | 2129 LookupResult result(isolate()); |
| 2130 to->LocalLookup(String::cast(raw_key), &result); | 2130 to->LocalLookup(String::cast(raw_key), &result); |
| 2131 if (result.IsProperty()) continue; | 2131 if (result.IsProperty()) continue; |
| 2132 // Set the property. | 2132 // Set the property. |
| 2133 Handle<String> key = Handle<String>(String::cast(raw_key)); | 2133 Handle<String> key = Handle<String>(String::cast(raw_key)); |
| 2134 Handle<Object> value = Handle<Object>(properties->ValueAt(i)); | 2134 Handle<Object> value = Handle<Object>(properties->ValueAt(i)); |
| 2135 if (value->IsJSGlobalPropertyCell()) { | 2135 if (value->IsJSGlobalPropertyCell()) { |
| 2136 value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value()); | 2136 value = Handle<Object>(JSGlobalPropertyCell::cast(*value)->value()); |
| 2137 } | 2137 } |
| 2138 PropertyDetails details = properties->DetailsAt(i); | 2138 PropertyDetails details = properties->DetailsAt(i); |
| 2139 SetLocalPropertyNoThrow(to, key, value, details.attributes()); | 2139 SetLocalPropertyNoThrow(to, key, value, details.attributes()); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2266 return from + sizeof(NestingCounterType); | 2266 return from + sizeof(NestingCounterType); |
| 2267 } | 2267 } |
| 2268 | 2268 |
| 2269 | 2269 |
| 2270 // Called when the top-level V8 mutex is destroyed. | 2270 // Called when the top-level V8 mutex is destroyed. |
| 2271 void Bootstrapper::FreeThreadResources() { | 2271 void Bootstrapper::FreeThreadResources() { |
| 2272 ASSERT(!IsActive()); | 2272 ASSERT(!IsActive()); |
| 2273 } | 2273 } |
| 2274 | 2274 |
| 2275 } } // namespace v8::internal | 2275 } } // namespace v8::internal |
| OLD | NEW |