OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 static Object* Runtime_GetTemplateField(Arguments args) { | 320 static Object* Runtime_GetTemplateField(Arguments args) { |
321 ASSERT(args.length() == 2); | 321 ASSERT(args.length() == 2); |
322 CONVERT_CHECKED(HeapObject, templ, args[0]); | 322 CONVERT_CHECKED(HeapObject, templ, args[0]); |
323 CONVERT_CHECKED(Smi, field, args[1]); | 323 CONVERT_CHECKED(Smi, field, args[1]); |
324 int index = field->value(); | 324 int index = field->value(); |
325 int offset = index * kPointerSize + HeapObject::kHeaderSize; | 325 int offset = index * kPointerSize + HeapObject::kHeaderSize; |
326 InstanceType type = templ->map()->instance_type(); | 326 InstanceType type = templ->map()->instance_type(); |
327 RUNTIME_ASSERT(type == FUNCTION_TEMPLATE_INFO_TYPE || | 327 RUNTIME_ASSERT(type == FUNCTION_TEMPLATE_INFO_TYPE || |
328 type == OBJECT_TEMPLATE_INFO_TYPE); | 328 type == OBJECT_TEMPLATE_INFO_TYPE); |
329 RUNTIME_ASSERT(offset > 0); | 329 RUNTIME_ASSERT(offset > 0); |
330 RUNTIME_ASSERT(offset < ((type == FUNCTION_TEMPLATE_INFO_TYPE) ? | 330 if (type == FUNCTION_TEMPLATE_INFO_TYPE) { |
331 FunctionTemplateInfo::kSize : ObjectTemplateInfo::kSize)); | 331 RUNTIME_ASSERT(offset < FunctionTemplateInfo::kSize); |
| 332 } else { |
| 333 RUNTIME_ASSERT(offset < ObjectTemplateInfo::kSize); |
| 334 } |
332 return HeapObject::RawField(templ, offset); | 335 return HeapObject::RawField(templ, offset); |
333 } | 336 } |
334 | 337 |
335 | 338 |
336 static Object* ThrowRedeclarationError(const char* type, Handle<String> name) { | 339 static Object* ThrowRedeclarationError(const char* type, Handle<String> name) { |
337 HandleScope scope; | 340 HandleScope scope; |
338 Handle<Object> type_handle = Factory::NewStringFromAscii(CStrVector(type)); | 341 Handle<Object> type_handle = Factory::NewStringFromAscii(CStrVector(type)); |
339 Handle<Object> args[2] = { type_handle, name }; | 342 Handle<Object> args[2] = { type_handle, name }; |
340 Handle<Object> error = | 343 Handle<Object> error = |
341 Factory::NewTypeError("redeclaration", HandleVector(args, 2)); | 344 Factory::NewTypeError("redeclaration", HandleVector(args, 2)); |
(...skipping 5188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5530 | 5533 |
5531 void Runtime::PerformGC(Object* result) { | 5534 void Runtime::PerformGC(Object* result) { |
5532 Failure* failure = Failure::cast(result); | 5535 Failure* failure = Failure::cast(result); |
5533 // Try to do a garbage collection; ignore it if it fails. The C | 5536 // Try to do a garbage collection; ignore it if it fails. The C |
5534 // entry stub will throw an out-of-memory exception in that case. | 5537 // entry stub will throw an out-of-memory exception in that case. |
5535 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); | 5538 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); |
5536 } | 5539 } |
5537 | 5540 |
5538 | 5541 |
5539 } } // namespace v8::internal | 5542 } } // namespace v8::internal |
OLD | NEW |