Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(736)

Side by Side Diff: src/contexts.cc

Issue 207613005: No longer OOM on invalid string length. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase + addressed nits Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/bootstrapper.cc ('k') | src/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 Object* Context::DeoptimizedCodeListHead() { 361 Object* Context::DeoptimizedCodeListHead() {
362 ASSERT(IsNativeContext()); 362 ASSERT(IsNativeContext());
363 return get(DEOPTIMIZED_CODE_LIST); 363 return get(DEOPTIMIZED_CODE_LIST);
364 } 364 }
365 365
366 366
367 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { 367 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() {
368 Handle<Object> result(error_message_for_code_gen_from_strings(), 368 Handle<Object> result(error_message_for_code_gen_from_strings(),
369 GetIsolate()); 369 GetIsolate());
370 if (!result->IsUndefined()) return result; 370 if (!result->IsUndefined()) return result;
371 return GetIsolate()->factory()->NewStringFromAscii(i::CStrVector( 371 return GetIsolate()->factory()->NewStringFromOneByte(STATIC_ASCII_VECTOR(
372 "Code generation from strings disallowed for this context")); 372 "Code generation from strings disallowed for this context"));
373 } 373 }
374 374
375 375
376 #ifdef DEBUG 376 #ifdef DEBUG
377 bool Context::IsBootstrappingOrValidParentContext( 377 bool Context::IsBootstrappingOrValidParentContext(
378 Object* object, Context* child) { 378 Object* object, Context* child) {
379 // During bootstrapping we allow all objects to pass as 379 // During bootstrapping we allow all objects to pass as
380 // contexts. This is necessary to fix circular dependencies. 380 // contexts. This is necessary to fix circular dependencies.
381 if (child->GetIsolate()->bootstrapper()->IsActive()) return true; 381 if (child->GetIsolate()->bootstrapper()->IsActive()) return true;
382 if (!object->IsContext()) return false; 382 if (!object->IsContext()) return false;
383 Context* context = Context::cast(object); 383 Context* context = Context::cast(object);
384 return context->IsNativeContext() || context->IsGlobalContext() || 384 return context->IsNativeContext() || context->IsGlobalContext() ||
385 context->IsModuleContext() || !child->IsModuleContext(); 385 context->IsModuleContext() || !child->IsModuleContext();
386 } 386 }
387 387
388 388
389 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) { 389 bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
390 // During bootstrapping we allow all objects to pass as global 390 // During bootstrapping we allow all objects to pass as global
391 // objects. This is necessary to fix circular dependencies. 391 // objects. This is necessary to fix circular dependencies.
392 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || 392 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
393 isolate->bootstrapper()->IsActive() || 393 isolate->bootstrapper()->IsActive() ||
394 object->IsGlobalObject(); 394 object->IsGlobalObject();
395 } 395 }
396 #endif 396 #endif
397 397
398 } } // namespace v8::internal 398 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698